diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-26 18:37:48 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-26 18:40:23 -0300 |
commit | 297bff7f8f01fbda2a6bacaed4afb3d060292b9f (patch) | |
tree | 06eeda209052a224a91f1dffc05b9e5d71999dc1 | |
parent | bc90ea63e9937d2eee3da7dce022bf4bed10e49a (diff) | |
download | rails-297bff7f8f01fbda2a6bacaed4afb3d060292b9f.tar.gz rails-297bff7f8f01fbda2a6bacaed4afb3d060292b9f.tar.bz2 rails-297bff7f8f01fbda2a6bacaed4afb3d060292b9f.zip |
Make sure Active Support configurations are applied correctly
Before this patch configuration set using config.active_support
would not be set.
Closes #15364
-rw-r--r-- | activesupport/lib/active_support/railtie.rb | 7 | ||||
-rw-r--r-- | railties/test/application/configuration_test.rb | 12 |
2 files changed, 19 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/railtie.rb b/activesupport/lib/active_support/railtie.rb index 1638512af0..65851a0937 100644 --- a/activesupport/lib/active_support/railtie.rb +++ b/activesupport/lib/active_support/railtie.rb @@ -55,5 +55,12 @@ module ActiveSupport Time.zone_default = zone_default end + + initializer "active_support.set_configs" do |app| + app.config.active_support.each do |k, v| + k = "#{k}=" + ActiveSupport.send(k, v) if ActiveSupport.respond_to? k + end + end end end diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index eb16713455..626dd64ea6 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -454,6 +454,18 @@ module ApplicationTests assert ActionView::Resolver.caching? end + test "configure Active Support using config.active_support" do + add_to_config <<-RUBY + config.active_support.escape_html_entities_in_json = true + RUBY + + require 'active_support/json' + require "#{app_path}/config/environment" + + assert ActiveSupport.escape_html_entities_in_json + assert ActiveSupport::JSON::Encoding.escape_html_entities_in_json + end + test "config.action_dispatch.show_exceptions is sent in env" do make_basic_app do |app| app.config.action_dispatch.show_exceptions = true |