mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix another regression related to the layout optimization.
This commit is contained in:
parent
c41f08cefe
commit
d4d99bbc87
2 changed files with 27 additions and 1 deletions
|
@ -76,6 +76,8 @@ module ActionView
|
|||
end
|
||||
when Proc
|
||||
resolve_layout(layout.call, keys)
|
||||
when FalseClass
|
||||
nil
|
||||
else
|
||||
layout
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue