This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Your other configuration i.e. github repo, branch, deploy_to etc | |
| ......... | |
| namespace :deploy do | |
| # Your other configuration i.e. start/stop puma/passanger/any other application server | |
| ...... | |
| before :updated, :setup_solr_data_dir do | |
| invoke 'solr:symlink' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CustomDeviseMailer < Devise::Mailer | |
| helper :application # gives access to all helpers defined within `application_helper`. | |
| include Devise::Controllers::UrlHelpers # Optional. eg. `confirmation_url` | |
| default template_path: 'devise/mailer' # to make sure that your mailer uses the devise views | |
| def reset_password_instructions(record, token, opts={}) | |
| opts[:subject] = I18n.t(:'devise.mailer.reset_password_instructions.subject', app_name: ENV['APP_NAME']) | |
| super | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module HasManyThrough | |
| extend ActiveSupport::Concern | |
| class_methods do | |
| def define_through associations = {} | |
| class_eval do | |
| associations.each do |model, through_model| | |
| model_name = model.to_s.underscore | |
| define_method "#{model_name}_ids" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| default: &default | |
| adapter: postgresql | |
| host: <%= ENV['DB_HOST'] %> | |
| encoding: unicode | |
| pool: 5 | |
| username: <%= ENV['DB_USERNAME'] %> | |
| password: <%= ENV['DB_PASSWORD'] %> | |
| database: <%= ENV['DB_DATABASE'] %> | |
| template: template0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CarrierWave.configure do |config| | |
| if Rails.env.development? or Rails.env.test? | |
| config.asset_host = "http://localhost:#{(ENV['PORT'].try(:to_i) || 3000)}" | |
| config.storage = :file | |
| else | |
| config.storage = :aws | |
| config.aws_bucket = ENV['S3_BUCKET_NAME'] || "contracts-#{Rails.env}" | |
| config.aws_acl = 'public-read' | |
| # Optionally define an asset host for configurations that are fronted by a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rails_root = Rails.root || File.dirname(__FILE__) + '/../..' | |
| rails_env = Rails.env || 'development' | |
| redis_config = YAML.load(ERB.new(File.read("#{Rails.root}/config/redis.yml")).result)[rails_env] | |
| redis_config.symbolize_keys! | |
| Sidekiq.configure_server do |config| | |
| config.redis = { url: "redis://#{redis_config[:host]}:#{redis_config[:port]}/12" } | |
| end | |
| Sidekiq.configure_client do |config| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Searchkick.class_eval do | |
| # Your new methods here | |
| def self.load_records(records, ids) | |
| records = | |
| if records.respond_to?(:queryable) | |
| # Mongoid 3+ | |
| records.queryable.for_ids(ids) | |
| elsif records.respond_to?(:primary_key) | |
| # ActiveRecord | |
| records.where(records.primary_key => ids) if records.primary_key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # config/initializers/rails_admin_delete_override.rb | |
| module RailsAdmin | |
| module Config | |
| module Actions | |
| class Delete < RailsAdmin::Config::Actions::Base | |
| RailsAdmin::Config::Actions.register(self) | |
| register_instance_option :visible? do | |
| !bindings[:object].respond_to?(:destroyable?) || bindings[:object].destroyable? | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GrapeSwaggerRails.options.url = '/api/v1/apis_doc.json' | |
| GrapeSwaggerRails.options.before_action do | |
| GrapeSwaggerRails.options.app_url = request.protocol + request.host_with_port | |
| end | |
| GrapeSwaggerRails.options.app_name = 'Service Name' | |
| GrapeSwaggerRails.options.api_auth = 'basic' # Or 'bearer' for OAuth | |
| GrapeSwaggerRails.options.api_key_name = 'Authorization' | |
| GrapeSwaggerRails.options.api_key_type = 'header' | |
| GrapeSwaggerRails.options.doc_expansion = 'list' |
OlderNewer