diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 7 | ||||
-rw-r--r-- | actionpack/test/controller/layout_test.rb | 3 |
3 files changed, 6 insertions, 6 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index c4cab1c037..2bc9e321e6 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Allow exempt_from_layout :rhtml. #6742, #7026 [dcmanges, Squeegy] + * Recognize the .txt extension as Mime::TEXT [Rick] * Fix parsing of array[] CGI parameters so extra empty values aren't included. #6252 [Nicholas Seckar, aiwilliams, brentrowland] diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index dd061ce143..8a3cb3eec3 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -1190,10 +1190,9 @@ module ActionController #:nodoc: end def template_exempt_from_layout?(template_name = default_template_name) - @@exempt_from_layout.any? { |ext| template_name =~ ext } or - @template.pick_template_extension(template_name) == :rjs - rescue - false + extension = @template.pick_template_extension(template_name) rescue nil + name_with_extension = !template_name.include?('.') && extension ? "#{template_name}.#{extension}" : template_name + extension == :rjs || @@exempt_from_layout.any? { |ext| name_with_extension =~ ext } end def assert_existence_of_template_file(template_name) diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb index 93ef1560f6..9338bfa6f9 100644 --- a/actionpack/test/controller/layout_test.rb +++ b/actionpack/test/controller/layout_test.rb @@ -106,14 +106,13 @@ class ExemptFromLayoutTest < Test::Unit::TestCase assert @controller.send(:template_exempt_from_layout?, 'test.rdoc') end - # TODO: http://dev.rubyonrails.org/ticket/6742 - # The rhtml exemption is ignored. def test_rhtml_exempt_from_layout_status_should_prevent_layout_render ActionController::Base.exempt_from_layout :rhtml assert @controller.send(:template_exempt_from_layout?, 'test.rhtml') get :hello assert_equal 'hello.rhtml', @response.body + ActionController::Base.exempt_from_layout.delete(/\.rhtml$/) end end |