Hello
with rails admin, I can insert the following code into initialisers and therefore prevent someone from going to
mysite.com/admin unless
that user is admin (admin is boolean in users table)
# prevent from going to /admin unless user is admin
config.authorize_with do
redirect_to main_app.root_path unless warden.user.admin?
end
My question is how do I protect a route/url with devise? Can I have the same functionality that rails admin gives me?
I know that I can define actions that require authentication (this article:
https://github.com/plataformatec/devise/wiki/How-To:-Define-resource-actions-that-require-authentication-using-routes.rb), but what about going a step further and authenticating an action with a certain user?
Thank you in advance!