diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index c482062592310..3b07e4cdba86b 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -309,7 +309,7 @@ def _write_layout_method # still does a dynamic lookup. In next Rails release, we should @_layout # to be inheritable so we can skip the child lookup if the parent explicitly # set the layout. - parent = self.superclass.instance_variable_get(:@_layout) + parent = self.superclass.instance_eval { @_layout if defined?(@_layout) } @_layout = nil inspect = parent.is_a?(Proc) ? parent.inspect : parent