Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

Fix layout lookup for anonymous controller
  • Loading branch information...
commit f9995ce0e03444e31d710a06e054365e33fee0d2 2 parents 1d21528 + b27c29e
@tenderlove tenderlove authored
View
4 actionpack/lib/abstract_controller/layouts.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
View
12 actionpack/test/abstract/layouts_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.