diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-01-17 08:56:50 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-01-17 18:07:08 -0200 |
commit | 9d4fd613a69378b38b061580e6b979e61fe9a823 (patch) | |
tree | 89bf9ebad515d310e804ce96bed13ba493c3a215 | |
parent | 57be2cfa1eb5cf04c86f4ab5461f6903df099b98 (diff) | |
download | rails-9d4fd613a69378b38b061580e6b979e61fe9a823.tar.gz rails-9d4fd613a69378b38b061580e6b979e61fe9a823.tar.bz2 rails-9d4fd613a69378b38b061580e6b979e61fe9a823.zip |
Add default charset config to ActionDispatch
-rw-r--r-- | actionpack/lib/action_dispatch/railtie.rb | 3 | ||||
-rw-r--r-- | railties/test/application/configuration_test.rb | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb index a4f4825f92..2bfeeb348f 100644 --- a/actionpack/lib/action_dispatch/railtie.rb +++ b/actionpack/lib/action_dispatch/railtie.rb @@ -11,6 +11,7 @@ module ActionDispatch config.action_dispatch.ignore_accept_header = false config.action_dispatch.rescue_templates = { } config.action_dispatch.rescue_responses = { } + config.action_dispatch.default_charset = nil config.action_dispatch.rack_cache = { :metastore => "rails:/", @@ -21,7 +22,7 @@ module ActionDispatch initializer "action_dispatch.configure" do |app| ActionDispatch::Http::URL.tld_length = app.config.action_dispatch.tld_length ActionDispatch::Request.ignore_accept_header = app.config.action_dispatch.ignore_accept_header - ActionDispatch::Response.default_charset = app.config.encoding + ActionDispatch::Response.default_charset = app.config.action_dispatch.default_charset || app.config.encoding ActionDispatch::ExceptionWrapper.rescue_responses.merge!(config.action_dispatch.rescue_responses) ActionDispatch::ExceptionWrapper.rescue_templates.merge!(config.action_dispatch.rescue_templates) diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index cedf5fe5d5..eb16713455 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -286,6 +286,14 @@ module ApplicationTests assert_equal res, last_response.body # value should be unchanged end + test "sets ActionDispatch::Response.default_charset" do + make_basic_app do |app| + app.config.action_dispatch.default_charset = "utf-16" + end + + assert_equal "utf-16", ActionDispatch::Response.default_charset + end + test "sets all Active Record models to whitelist all attributes by default" do add_to_config <<-RUBY config.active_record.whitelist_attributes = true |