aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-08 22:56:50 +0100
committerJosé Valim <jose.valim@gmail.com>2011-12-08 22:56:50 +0100
commitd4d99bbc87021fad1df516cb24912973d186279d (patch)
tree0967350a546cdb86d7cc2850c731490afa150e75
parentc41f08cefe6fa3747ee79001d9c88dc988e8064d (diff)
downloadrails-d4d99bbc87021fad1df516cb24912973d186279d.tar.gz
rails-d4d99bbc87021fad1df516cb24912973d186279d.tar.bz2
rails-d4d99bbc87021fad1df516cb24912973d186279d.zip
Fix another regression related to the layout optimization.
-rw-r--r--actionpack/lib/action_view/renderer/template_renderer.rb2
-rw-r--r--actionpack/test/controller/new_base/render_layout_test.rb26
2 files changed, 27 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/renderer/template_renderer.rb b/actionpack/lib/action_view/renderer/template_renderer.rb
index 1771fb0063..e131afa279 100644
--- a/actionpack/lib/action_view/renderer/template_renderer.rb
+++ b/actionpack/lib/action_view/renderer/template_renderer.rb
@@ -76,6 +76,8 @@ module ActionView
end
when Proc
resolve_layout(layout.call, keys)
+ when FalseClass
+ nil
else
layout
end
diff --git a/actionpack/test/controller/new_base/render_layout_test.rb b/actionpack/test/controller/new_base/render_layout_test.rb
index 73c2d8244a..4ac40ca405 100644
--- a/actionpack/test/controller/new_base/render_layout_test.rb
+++ b/actionpack/test/controller/new_base/render_layout_test.rb
@@ -82,7 +82,7 @@ module ControllerLayouts
class MismatchFormatTest < Rack::TestCase
testing ControllerLayouts::MismatchFormatController
-
+
XML_INSTRUCT = %Q(<?xml version="1.0" encoding="UTF-8"?>\n)
test "if XML is selected, an HTML template is not also selected" do
@@ -100,4 +100,28 @@ module ControllerLayouts
assert_response "alert('foo');"
end
end
+
+ class FalseLayoutMethodController < ::ApplicationController
+ self.view_paths = [ActionView::FixtureResolver.new(
+ "controller_layouts/false_layout_method/index.js.erb" => "alert('foo');"
+ )]
+
+ layout :which_layout?
+
+ def which_layout?
+ false
+ end
+
+ def index
+ end
+ end
+
+ class FalseLayoutMethodTest < Rack::TestCase
+ testing ControllerLayouts::FalseLayoutMethodController
+
+ test "access false layout returned by a method/proc" do
+ get :index, :format => "js"
+ assert_response "alert('foo');"
+ end
+ end
end