I have a admin namespace and Admin::UserController controller. When I try to use a layout called admin with symbol, the rails throw an exception, but if I call layout admin as a string, works sucessfull.
The exception message is the following:
You specified nil as the layout, but no such method was found
I just want to know why this happens...
thanks.
As per here:
http://ap.rubyonrails.org/classes/ActionController/Layout/ClassMethods.html
Sometimes you want to alternate layouts depending on runtime information, such as whether someone is logged in or not. This can be done either by specifying a method reference as a symbol or using an inline method (as a proc).
So long story short, when you specify a symbol, Rails actually expects that to be a method reference, thus the reason why it is claiming that there was no method found.
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