Fix layout lookup for anonymous controller
This commit is contained in:
parent
699ba8ab52
commit
b27c29ef4a
@ -280,6 +280,10 @@ def _write_layout_method
|
|||||||
<<-RUBY
|
<<-RUBY
|
||||||
lookup_context.find_all("#{_implied_layout_name}", #{prefixes.inspect}).first || super
|
lookup_context.find_all("#{_implied_layout_name}", #{prefixes.inspect}).first || super
|
||||||
RUBY
|
RUBY
|
||||||
|
else
|
||||||
|
<<-RUBY
|
||||||
|
super
|
||||||
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
layout_definition = case _layout
|
layout_definition = case _layout
|
||||||
|
@ -299,6 +299,18 @@ class ::BadFailLayout < AbstractControllerTests::Layouts::Base
|
|||||||
controller.process(:index)
|
controller.process(:index)
|
||||||
assert_equal "Overwrite Hello index!", controller.response_body
|
assert_equal "Overwrite Hello index!", controller.response_body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "layout for anonymous controller" do
|
||||||
|
klass = Class.new(WithString) do
|
||||||
|
def index
|
||||||
|
render :text => 'index', :layout => true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
controller = klass.new
|
||||||
|
controller.process(:index)
|
||||||
|
assert_equal "With String index", controller.response_body
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user