From b27c29ef4a26755b8de04686241694ce5ee33724 Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Tue, 28 Feb 2012 10:57:28 +0400 Subject: Fix layout lookup for anonymous controller --- actionpack/lib/abstract_controller/layouts.rb | 4 ++++ actionpack/test/abstract/layouts_test.rb | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index aa39e21ba9..92e93cbee7 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -280,6 +280,10 @@ module AbstractController <<-RUBY lookup_context.find_all("#{_implied_layout_name}", #{prefixes.inspect}).first || super RUBY + else + <<-RUBY + super + RUBY end layout_definition = case _layout diff --git a/actionpack/test/abstract/layouts_test.rb b/actionpack/test/abstract/layouts_test.rb index fc25718d9e..e07a6de4a9 100644 --- a/actionpack/test/abstract/layouts_test.rb +++ b/actionpack/test/abstract/layouts_test.rb @@ -299,6 +299,18 @@ module AbstractControllerTests controller.process(:index) assert_equal "Overwrite Hello index!", controller.response_body 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 -- cgit v1.2.3