I’m using Devise and a user can either be an admin or not (true, false).
Can someone help me figure out how to protect a controller action such as:
def new
@post = Post.new
end
I know Devise lets you call administrators by using in views but can this be used in controllers?:
if current_user.admin?
Thanks in advance.
You can simply add a filter, this way:
or use CanCan or something like that, to hold restrictions nicely