I'm using the gem rails admin
and pundit
. I'm trying to ensure that only admin users
can see the admin dashboard, but I've never used pundit before. I feel as though this must be a well documented answer but I can't seem to find what I'm looking for so hopefully some can help me here. Here is my code:
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
I have that in my routes.rb file, But right now every user has access to it how can I wrap it in a condition checking for if the user is an admin? Like I said I have an admin
boolean on user
. Thanks for the help!
You can specify request based constraints to specify the guard conditions.