lib/rails-env.rb in rails-env-1.0.8 vs lib/rails-env.rb in rails-env-2.0.0
- old
+ new
@@ -6,11 +6,11 @@
class << self
env_method = instance_method(:env=)
remove_method(:env=)
define_method :env= do |env|
- env_method.bind(self).call(env)
+ env_method.bind_call(self, env)
Rails.env.extend(RailsEnv::Extension)
end
end
end
@@ -49,27 +49,38 @@
def self.propagate_i18n
I18n.available_locales = (config.i18n.available_locales || [])
.compact
.map(&:to_sym)
.uniq
+
if config.i18n.default_locale
I18n.default_locale = config.i18n.default_locale
end
+
+ if config.i18n.respond_to?(:raise_on_missing_translations)
+ ActionView::Base.raise_on_missing_translations =
+ config.i18n.raise_on_missing_translations
+ end
+
I18n.locale = config.i18n.locale if config.i18n.locale
I18n.load_path += config.i18n.load_path if config.i18n.load_path
end
def self.propagate_autoload_paths
all_autoload_paths = (
config.autoload_paths +
config.eager_load_paths +
- config.autoload_once_paths
- ).uniq
+ config.autoload_once_paths +
+ ActiveSupport::Dependencies.autoload_paths
+ ).uniq.freeze
- ActiveSupport::Dependencies.autoload_paths.unshift(*all_autoload_paths)
- ActiveSupport::Dependencies.autoload_once_paths.unshift(
- *config.autoload_once_paths
- )
+ all_autoload_once_paths = (
+ config.autoload_once_paths +
+ ActiveSupport::Dependencies.autoload_once_paths
+ ).uniq.freeze
+
+ ActiveSupport::Dependencies.autoload_paths = all_autoload_paths
+ ActiveSupport::Dependencies.autoload_once_paths = all_autoload_once_paths
end
def self.propagate(options_name, target_name, target_property = nil)
return unless Object.const_defined?(target_name)
return unless config.respond_to?(options_name)