diff options
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/layout.rb | 6 | ||||
-rw-r--r-- | actionpack/test/controller/layout_test.rb | 18 | ||||
-rw-r--r-- | actionpack/test/fixtures/layout_tests/alt/hello.rhtml | 1 |
4 files changed, 24 insertions, 3 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 71dfdd8b3f..6816d18261 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *2.0.0 [Preview Release]* (September 29th, 2007) [Includes duplicates of changes from 1.12.2 - 1.13.3] +* Fixed that render template did not honor exempt_from_layout #9698 [pezra] + * Better error messages if you leave out the :secret option for request forgery protection. Closes #9670 [rick] * Allow ability to disable request forgery protection, disable it in test mode by default. Closes #9693 [lifofifo] diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb index c41e14736c..27ff16c835 100644 --- a/actionpack/lib/action_controller/layout.rb +++ b/actionpack/lib/action_controller/layout.rb @@ -277,8 +277,8 @@ module ActionController #:nodoc: def candidate_for_layout?(options) (options.has_key?(:layout) && options[:layout] != false) || - options.values_at(:text, :xml, :json, :file, :inline, :partial, :nothing).compact.empty? && - !template_exempt_from_layout?(default_template_name(options[:action] || options[:template])) + options.values_at(:text, :xml, :json, :file, :inline, :partial, :nothing).compact.empty? && + !template_exempt_from_layout?(options[:template] || default_template_name(options[:action])) end def pick_layout(template_with_options, options) @@ -320,4 +320,4 @@ module ActionController #:nodoc: end end end -end
\ No newline at end of file +end diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb index cad5720742..f194539fcf 100644 --- a/actionpack/test/controller/layout_test.rb +++ b/actionpack/test/controller/layout_test.rb @@ -180,8 +180,26 @@ class LayoutSetInResponseTest < Test::Unit::TestCase get :hello assert_nil @response.layout end + + def test_exempt_from_layout_honored_by_render_template + ActionController::Base.exempt_from_layout :rhtml + @controller = RenderWithTemplateOptionController.new + + assert @controller.send(:template_exempt_from_layout?, 'alt/hello.rhtml') + + get :hello + assert_equal "alt/hello.rhtml", @response.body.strip + + ensure + ActionController::Base.exempt_from_layout.delete(/\.rhtml$/) + end end +class RenderWithTemplateOptionController < LayoutTest + def hello + render :template => 'alt/hello' + end +end class SetsNonExistentLayoutFile < LayoutTest layout "nofile.rhtml" diff --git a/actionpack/test/fixtures/layout_tests/alt/hello.rhtml b/actionpack/test/fixtures/layout_tests/alt/hello.rhtml new file mode 100644 index 0000000000..fcda6cf97a --- /dev/null +++ b/actionpack/test/fixtures/layout_tests/alt/hello.rhtml @@ -0,0 +1 @@ +alt/hello.rhtml |