diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-12-03 02:34:11 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-12-03 02:34:11 -0500 |
commit | 9ed3aab6927471078888ff51c255561350946344 (patch) | |
tree | 337d71804afb740c0def41359239186fcb28317b /actionpack | |
parent | c48a0cac626b4e32d7abfa9f4f1fae16568157d9 (diff) | |
parent | 43962d6ec50f918c9970bd3cd4b6ee5c7f7426ed (diff) | |
download | rails-9ed3aab6927471078888ff51c255561350946344.tar.gz rails-9ed3aab6927471078888ff51c255561350946344.tar.bz2 rails-9ed3aab6927471078888ff51c255561350946344.zip |
Merge branch 'format_localized_template' of https://github.com/acapilleri/rails
Conflicts:
actionpack/CHANGELOG.md
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG.md | 9 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/rendering.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/localized_templates_test.rb | 11 | ||||
-rw-r--r-- | actionpack/test/fixtures/localized/hello_world.it.erb | 1 |
4 files changed, 22 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index cfefeb23ce..330d015733 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,3 +1,12 @@ +* Fix header Content-Type: #<Mime::NullType:...> in localized template + + When localized template has no format in the template name, + now the response has the default and correct `content-type`. + + Fix #13064. + + *Angelo Capilleri* + * Try to escape each part of a url correctly when using a redirect route. Fixes #13110. diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb index 5c48b4ab98..cb2965abac 100644 --- a/actionpack/lib/action_controller/metal/rendering.rb +++ b/actionpack/lib/action_controller/metal/rendering.rb @@ -34,7 +34,7 @@ module ActionController def _process_format(format) super - self.content_type ||= format.to_s + self.content_type ||= format.to_s unless format.nil? #here test if format is Mime::NullTye istance, no if is a NillClass or FalseClass end # Normalize arguments by catching blocks and setting them on :update. diff --git a/actionpack/test/controller/localized_templates_test.rb b/actionpack/test/controller/localized_templates_test.rb index 6b02eedaed..c95ef8a0c7 100644 --- a/actionpack/test/controller/localized_templates_test.rb +++ b/actionpack/test/controller/localized_templates_test.rb @@ -34,4 +34,15 @@ class LocalizedTemplatesTest < ActionController::TestCase get :hello_world assert_equal "Gutten Tag", @response.body end + + def test_localized_template_has_correct_header_with_no_format_in_template_name + old_locale = I18n.locale + I18n.locale = :it + + get :hello_world + assert_equal "Ciao Mondo", @response.body + assert_equal "text/html", @response.content_type + ensure + I18n.locale = old_locale + end end diff --git a/actionpack/test/fixtures/localized/hello_world.it.erb b/actionpack/test/fixtures/localized/hello_world.it.erb new file mode 100644 index 0000000000..9191fdc187 --- /dev/null +++ b/actionpack/test/fixtures/localized/hello_world.it.erb @@ -0,0 +1 @@ +Ciao Mondo
\ No newline at end of file |