Skip to content

Commit

Permalink
Fix another regression related to the layout optimization.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Dec 8, 2011
1 parent c41f08c commit d4d99bb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions actionpack/lib/action_view/renderer/template_renderer.rb
Expand Up @@ -76,6 +76,8 @@ def resolve_layout(layout, keys)
end
when Proc
resolve_layout(layout.call, keys)
when FalseClass
nil
else
layout
end
Expand Down
26 changes: 25 additions & 1 deletion actionpack/test/controller/new_base/render_layout_test.rb
Expand Up @@ -82,7 +82,7 @@ def explicit

class MismatchFormatTest < Rack::TestCase
testing ControllerLayouts::MismatchFormatController

XML_INSTRUCT = %Q(<?xml version="1.0" encoding="UTF-8"?>\n)

test "if XML is selected, an HTML template is not also selected" do
Expand All @@ -100,4 +100,28 @@ class MismatchFormatTest < Rack::TestCase
assert_response "alert('foo');"
end
end

class FalseLayoutMethodController < ::ApplicationController
self.view_paths = [ActionView::FixtureResolver.new(
"controller_layouts/false_layout_method/index.js.erb" => "alert('foo');"
)]

layout :which_layout?

def which_layout?
false
end

def index
end
end

class FalseLayoutMethodTest < Rack::TestCase
testing ControllerLayouts::FalseLayoutMethodController

test "access false layout returned by a method/proc" do
get :index, :format => "js"
assert_response "alert('foo');"
end
end
end

0 comments on commit d4d99bb

Please sign in to comment.