Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 f9995ce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions actionpack/lib/abstract_controller/layouts.rb
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions actionpack/test/abstract/layouts_test.rb
Expand Up @@ -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.