I just upgraded my Rails site from Rails 2 to Rails 3.2.
On my old controller I had:
class Foo::BarController < ApplicationController
layout nil
...
end
However now that I upgraded to Rails 3 it seems I need to change that to:
layout false
The documentation on Rails Guides claims that layout nil
should work fine:
Layout declarations cascade downward in the hierarchy ...
class OldPostsController < SpecialPostsController
layout nil
I have the following relevant gems in my Gemfile.lock
GEM
actionpack (3.2.6)
activemodel (= 3.2.6)
activesupport (= 3.2.6)
builder (~> 3.0.0)
erubis (~> 2.7.0)
builder (3.0.0)
erubis (2.7.0)
haml (3.1.6)
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
Is this a documented change somewhere, or is it a related gem monkey patching something?
The API explains it like this:
If the specified layout is:
false
: there is no layouttrue
: raise an ArgumentError
nil
: force default layout behavior with inheritanceSo the meaning of nil
changed from no layout to "force default layout behavior with inheritance". Seems the explanation in Rails Guides is incorrect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With