aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorSaimon Moore <saimon@saimonmoore.net>2011-01-28 13:53:07 +0100
committerSantiago Pastorino <santiago@wyeworks.com>2011-02-01 15:35:48 -0200
commitb1ca339b53559a71958c02644e329c714037f616 (patch)
tree0234f83ff3d3a7dd422635ceaab6b0368716b84c /activesupport/lib/active_support
parentcb9fa5283239e649483ea31ca372e99aaac2ca07 (diff)
downloadrails-b1ca339b53559a71958c02644e329c714037f616.tar.gz
rails-b1ca339b53559a71958c02644e329c714037f616.tar.bz2
rails-b1ca339b53559a71958c02644e329c714037f616.zip
Additionally trigger i18n configuration setup before any eager loading [#6353 state:resolved]
This handles the case where config.cache_classes is true and classes are loaded before the I18n load path has had a chance to be populated. Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/i18n_railtie.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/i18n_railtie.rb b/activesupport/lib/active_support/i18n_railtie.rb
index 282337d373..7fdc908bbd 100644
--- a/activesupport/lib/active_support/i18n_railtie.rb
+++ b/activesupport/lib/active_support/i18n_railtie.rb
@@ -24,9 +24,8 @@ module I18n
end
end
- # Set the i18n configuration only after initialization since a lot of
- # configuration is still usually done in application initializers.
- config.after_initialize do |app|
+ # Proc to set up i18n configuration
+ init_load_path = Proc.new do |app|
fallbacks = app.config.i18n.delete(:fallbacks)
app.config.i18n.each do |setting, value|
@@ -46,6 +45,14 @@ module I18n
reloader.execute_if_updated
end
+ # Set the i18n configuration only after initialization since a lot of
+ # configuration is still usually done in application initializers.
+ config.after_initialize(&init_load_path)
+
+ # Trigger i18n config before any eager loading has happened
+ # so it's ready if any classes require it when eager loaded
+ config.before_eager_load(&init_load_path)
+
protected
def self.include_fallbacks_module
@@ -78,4 +85,4 @@ module I18n
end
end
end
-end \ No newline at end of file
+end