I use Rails Admin and Devise for admin and user model. I have added one column "admin" to the user model to indicate its identity.
In the config/routes.rb
, I mount /admin
for RailsAdmin:Engine
I want to only allow current_user.admin
users to access /admin
, otherwise, redirect user to home page.
How can I implement this in the cleanest code?