Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow exempt_from_layout :rhtml. References #6742, closes #7026.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5927 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 55efae272065c66f2f10ab786c300213e910465c 1 parent a6e12c0
@jeremy jeremy authored
View
2  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]
View
7 actionpack/lib/action_controller/base.rb
@@ -1190,10 +1190,9 @@ def template_public?(template_name = default_template_name)
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)
View
3  actionpack/test/controller/layout_test.rb
@@ -106,14 +106,13 @@ def test_add_regexp_to_exempt_from_layout
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
Please sign in to comment.
Something went wrong with that request. Please try again.