Revert "Merge pull request #19685 from vngrs/actionview_parent_layout_bug"
This reverts commita9d58c77da
, reversing changes made to041c2c879a
. Reason: The old behavior is how it was working in previous version of Rails since 4.0.x so it is not safe to backport to a stable branch. See https://github.com/rails/rails/issues/19626#issuecomment-89862258 and https://github.com/rails/rails/pull/15050#issuecomment-45333449
This commit is contained in:
parent
4519727cdb
commit
8193a09a1f
|
@ -315,14 +315,6 @@ module ActionView
|
||||||
name_clause
|
name_clause
|
||||||
end
|
end
|
||||||
|
|
||||||
if self._layout_conditions.empty?
|
|
||||||
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
||||||
def _layout
|
|
||||||
#{layout_definition}
|
|
||||||
end
|
|
||||||
private :_layout
|
|
||||||
RUBY
|
|
||||||
else
|
|
||||||
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
||||||
def _layout
|
def _layout
|
||||||
if _conditional_layout?
|
if _conditional_layout?
|
||||||
|
@ -334,7 +326,6 @@ module ActionView
|
||||||
private :_layout
|
private :_layout
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
@ -122,14 +122,6 @@ class PrependsViewPathController < LayoutTest
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class ParentController < LayoutTest
|
|
||||||
layout 'item'
|
|
||||||
end
|
|
||||||
|
|
||||||
class ChildController < ParentController
|
|
||||||
layout 'layout_test', only: :hello
|
|
||||||
end
|
|
||||||
|
|
||||||
class OnlyLayoutController < LayoutTest
|
class OnlyLayoutController < LayoutTest
|
||||||
layout 'item', :only => "hello"
|
layout 'item', :only => "hello"
|
||||||
end
|
end
|
||||||
|
@ -233,12 +225,6 @@ class LayoutSetInResponseTest < ActionController::TestCase
|
||||||
get :hello
|
get :hello
|
||||||
assert_equal "layout_test.erb hello.erb", @response.body.strip
|
assert_equal "layout_test.erb hello.erb", @response.body.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_respect_to_parent_layout
|
|
||||||
@controller = ChildController.new
|
|
||||||
get :goodbye
|
|
||||||
assert_includes @response.body, 'item.erb'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class SetsNonExistentLayoutFile < LayoutTest
|
class SetsNonExistentLayoutFile < LayoutTest
|
||||||
|
|
Loading…
Reference in New Issue