Skip to content

Commit b27c29e

Browse files
committed
Fix layout lookup for anonymous controller
1 parent 699ba8a commit b27c29e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

actionpack/lib/abstract_controller/layouts.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ def _write_layout_method
280280
<<-RUBY
281281
lookup_context.find_all("#{_implied_layout_name}", #{prefixes.inspect}).first || super
282282
RUBY
283+
else
284+
<<-RUBY
285+
super
286+
RUBY
283287
end
284288

285289
layout_definition = case _layout

actionpack/test/abstract/layouts_test.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,18 @@ class ::BadFailLayout < AbstractControllerTests::Layouts::Base
299299
controller.process(:index)
300300
assert_equal "Overwrite Hello index!", controller.response_body
301301
end
302+
303+
test "layout for anonymous controller" do
304+
klass = Class.new(WithString) do
305+
def index
306+
render :text => 'index', :layout => true
307+
end
308+
end
309+
310+
controller = klass.new
311+
controller.process(:index)
312+
assert_equal "With String index", controller.response_body
313+
end
302314
end
303315
end
304316
end

0 commit comments

Comments
 (0)