diff options
author | Xavier Noria <fxn@hashref.com> | 2011-01-20 10:34:17 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-01-20 10:34:17 +0100 |
commit | 02319b7982fa7e55aecf79ede8bf0cb6961e0206 (patch) | |
tree | 2b63c0e0398ec79d042d72864092000181dc3e7e /actionpack | |
parent | 236f1f52cdcb695ee42ec1ad384fc9bee643f435 (diff) | |
parent | bc9b1075aec2a63f789b105cd11886a2c8c45ccf (diff) | |
download | rails-02319b7982fa7e55aecf79ede8bf0cb6961e0206.tar.gz rails-02319b7982fa7e55aecf79ede8bf0cb6961e0206.tar.bz2 rails-02319b7982fa7e55aecf79ede8bf0cb6961e0206.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/abstract_controller/rendering.rb | 9 | ||||
-rw-r--r-- | actionpack/lib/action_view/lookup_context.rb | 4 | ||||
-rw-r--r-- | actionpack/test/template/lookup_context_test.rb | 2 |
3 files changed, 8 insertions, 7 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index 9b912ea988..ec1160c31e 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -13,14 +13,15 @@ module AbstractController # This is a class to fix I18n global state. Whenever you provide I18n.locale during a request, # it will trigger the lookup_context and consequently expire the cache. class I18nProxy < ::I18n::Config #:nodoc: - attr_reader :i18n_config, :lookup_context + attr_reader :original_config, :lookup_context - def initialize(i18n_config, lookup_context) - @i18n_config, @lookup_context = i18n_config, lookup_context + def initialize(original_config, lookup_context) + original_config = original_config.original_config if original_config.respond_to?(:original_config) + @original_config, @lookup_context = original_config, lookup_context end def locale - @i18n_config.locale + @original_config.locale end def locale=(value) diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb index 1365048724..e434f3b059 100644 --- a/actionpack/lib/action_view/lookup_context.rb +++ b/actionpack/lib/action_view/lookup_context.rb @@ -186,11 +186,11 @@ module ActionView end # Overload locale= to also set the I18n.locale. If the current I18n.config object responds - # to i18n_config, it means that it's has a copy of the original I18n configuration and it's + # to original_config, it means that it's has a copy of the original I18n configuration and it's # acting as proxy, which we need to skip. def locale=(value) if value - config = I18n.config.respond_to?(:i18n_config) ? I18n.config.i18n_config : I18n.config + config = I18n.config.respond_to?(:original_config) ? I18n.config.original_config : I18n.config config.locale = value end diff --git a/actionpack/test/template/lookup_context_test.rb b/actionpack/test/template/lookup_context_test.rb index f7a684779c..f3b1335000 100644 --- a/actionpack/test/template/lookup_context_test.rb +++ b/actionpack/test/template/lookup_context_test.rb @@ -73,7 +73,7 @@ class LookupContextTest < ActiveSupport::TestCase assert_equal :pt, I18n.locale assert_equal :pt, @lookup_context.locale ensure - I18n.config = I18n.config.i18n_config + I18n.config = I18n.config.original_config end assert_equal :pt, I18n.locale |