Skip to content
This repository
Browse code

Fix another regression related to the layout optimization.

  • Loading branch information...
commit d4d99bbc87021fad1df516cb24912973d186279d 1 parent c41f08c
José Valim josevalim authored
2  actionpack/lib/action_view/renderer/template_renderer.rb
@@ -76,6 +76,8 @@ def resolve_layout(layout, keys)
76 76 end
77 77 when Proc
78 78 resolve_layout(layout.call, keys)
  79 + when FalseClass
  80 + nil
79 81 else
80 82 layout
81 83 end
26 actionpack/test/controller/new_base/render_layout_test.rb
@@ -82,7 +82,7 @@ def explicit
82 82
83 83 class MismatchFormatTest < Rack::TestCase
84 84 testing ControllerLayouts::MismatchFormatController
85   -
  85 +
86 86 XML_INSTRUCT = %Q(<?xml version="1.0" encoding="UTF-8"?>\n)
87 87
88 88 test "if XML is selected, an HTML template is not also selected" do
@@ -100,4 +100,28 @@ class MismatchFormatTest < Rack::TestCase
100 100 assert_response "alert('foo');"
101 101 end
102 102 end
  103 +
  104 + class FalseLayoutMethodController < ::ApplicationController
  105 + self.view_paths = [ActionView::FixtureResolver.new(
  106 + "controller_layouts/false_layout_method/index.js.erb" => "alert('foo');"
  107 + )]
  108 +
  109 + layout :which_layout?
  110 +
  111 + def which_layout?
  112 + false
  113 + end
  114 +
  115 + def index
  116 + end
  117 + end
  118 +
  119 + class FalseLayoutMethodTest < Rack::TestCase
  120 + testing ControllerLayouts::FalseLayoutMethodController
  121 +
  122 + test "access false layout returned by a method/proc" do
  123 + get :index, :format => "js"
  124 + assert_response "alert('foo');"
  125 + end
  126 + end
103 127 end

0 comments on commit d4d99bb

Please sign in to comment.
Something went wrong with that request. Please try again.