Sha256: 8103839b8630c10cc19085cdeaf8984fa03103e0cdfb460f96d7457ccb70dd1a

Contents?: true

Size: 1.19 KB

Versions: 12

Compression:

Stored size: 1.19 KB

Contents

module Config
  module Integrations
    module Rails
      class Railtie < ::Rails::Railtie
        def preload
          # Manually load the custom initializer before everything else
          initializer = ::Rails.root.join('config', 'initializers', 'config.rb')
          require initializer if File.exist?(initializer)

          # Parse the settings before any of the initializers
          Config.load_and_set_settings(
            Config.setting_files(::Rails.root.join('config'), ::Rails.env)
          )
        end

        # Load rake tasks (eg. Heroku)
        rake_tasks do
          Dir[File.join(File.dirname(__FILE__), '../tasks/*.rake')].each { |f| load f }
        end

        config.before_configuration { preload }

        # Development environment should reload settings on every request
        if ::Rails.env.development?
          initializer :config_reload_on_development do
            ActionController::Base.class_eval do
              if ::Rails::VERSION::MAJOR >= 4
                prepend_before_action { ::Config.reload! }
              else
                prepend_before_filter { ::Config.reload! }
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
config-2.1.0 lib/config/integrations/rails/railtie.rb
config-2.0.0 lib/config/integrations/rails/railtie.rb
config-1.7.2 lib/config/integrations/rails/railtie.rb
config-1.7.1 lib/config/integrations/rails/railtie.rb
ef-config-1.4.1 lib/config/integrations/rails/railtie.rb
config-1.7.0 lib/config/integrations/rails/railtie.rb
config-1.6.1 lib/config/integrations/rails/railtie.rb
config-1.6.0 lib/config/integrations/rails/railtie.rb
config-1.5.1 lib/config/integrations/rails/railtie.rb
config-1.5.0 lib/config/integrations/rails/railtie.rb
config-1.4.0 lib/config/integrations/rails/railtie.rb
config-1.3.0 lib/config/integrations/rails/railtie.rb