Answer the question
In order to leave comments, you need to log in
Rails - devise how to redirect from controller if user is on admin?
Hello!
It is necessary to redirect the user from the controller if he is not authorized and not an admin.
I do it like this:
class AdminController < ApplicationController
before_filter :authenticate_user!
def home
unless @current_user.admin?
redirect_to ###
end
end
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question