Layout with symbol generates an error

I have a namespace admin and Admin :: UserController. When I try to use a layout called admin with a character, the rails throw an exception, but if I call layout admin as a string, sucessfull works.

Exception Message:

You specified zero as a layout, but no such method was found

I just want to know why this is happening ...

thanks.

+4
source share
1 answer

Like here:

http://ap.rubyonrails.org/classes/ActionController/Layout/ClassMethods.html

Sometimes you want to alternate layouts depending on the execution time of the information, for example, logged in or not. This can be done either by specifying the link method as a symbol or using the built-in method (like proc).

In short, when you specify a character, Rails actually expects it to be a reference to a method, so the reason it claims that no method was found.

+9
source

Source: https://habr.com/ru/post/1348198/


All Articles