Permalink
Browse files

Fix layout lookup for anonymous controller

  • Loading branch information...
1 parent 699ba8a commit b27c29ef4a26755b8de04686241694ce5ee33724 @avakhov avakhov committed Feb 28, 2012
Showing with 16 additions and 0 deletions.
  1. +4 −0 actionpack/lib/abstract_controller/layouts.rb
  2. +12 −0 actionpack/test/abstract/layouts_test.rb
@@ -280,6 +280,10 @@ def _write_layout_method
<<-RUBY
lookup_context.find_all("#{_implied_layout_name}", #{prefixes.inspect}).first || super
RUBY
+ else
+ <<-RUBY
+ super
+ RUBY
end
layout_definition = case _layout
@@ -299,6 +299,18 @@ class ::BadFailLayout < AbstractControllerTests::Layouts::Base
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

0 comments on commit b27c29e

Please sign in to comment.