Sha256: bbfa05d992800b4491f21aae2af5f495c435e4a37bc0d11499554ea47731f5fb

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

if defined?(Rails::Railtie)
  module RailsConfig
    class Railtie < Rails::Railtie

      # manually load the custom initializer before everything else
      initializer :load_custom_rails_config, :before => :bootstrap_hook do
        initializer = Rails.root.join("config", "initializers", "rails_config")
        require initializer if File.exist?(initializer)
      end

      # Parse the settings before any of the initializers
      ActiveSupport.on_load :before_configuration, :yield => true do
        RailsConfig.load_and_set_settings(
          Rails.root.join("config", "settings.yml").to_s,
          Rails.root.join("config", "settings", "#{Rails.env}.yml").to_s,
          Rails.root.join("config", "environments", "#{Rails.env}.yml").to_s
        )
      end

      # Rails Dev environment should reload the Settings on every request
      if Rails.env.development?
        initializer :rails_config_reload_on_development do
          ActionController::Base.class_eval do
            prepend_before_filter { ::Settings.reload! }
          end
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_config-0.1.8 lib/rails_config/railtie.rb