I am using rails_admin
gem with rails
4. Currently I am using this method
# Authorize just admin for '/admin'
config.authorize_with do
redirect_to main_app.root_path unless warden.user.admin == true
end
under config/initializers/rails_admin.rb
to permit only the admin user to access the dashboard. PROBLEM: if the current user is admin and he/she is trying to change her permission to regular user (unticking) admin
box then they get an error saying that no method for nil:admin
- this is happening because /admin
is no longer available for this regular user. QUESTION: How can I disallow the current user edit his own admin
property ???
Aucun commentaire:
Enregistrer un commentaire