Permalink
Browse files

Merge pull request #5203 from avakhov/anonymous-controller-layout

Fix layout lookup for anonymous controller
  • Loading branch information...
tenderlove committed Feb 29, 2012
2 parents 1d21528 + b27c29e commit f9995ce0e03444e31d710a06e054365e33fee0d2
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 f9995ce

Please sign in to comment.