Rails: Multiple layouts with Devise -


how can have different layout depending on wether user logged in or not?

follow instructions at
https://github.com/plataformatec/devise/wiki/how-to%3a-create-custom-layouts
, make check if user logged in, devise means checking
user_signed_in?, devise helper.

specifically:

class applicationcontroller < actioncontroller::base layout :layout_by_resource protected def layout_by_resource if user_signed_in? "special_layout_name_for_logged_in" else "application" end end end 

and put special_layout_for_logged_in.html.erb view file in layouts directory.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -