Code like song
A client asked me to provide database access for simple reporting, and we settled on using rails_admin. But I wanted to prevent any changes to the database. To create a completely read-only rails_admin
installation, just add this to your config/initializers/rails_admin.rb
:
config.actions do
# root actions
dashboard
# collection actions
index
export
# member actions
show
show_in_app
end
Also you should make sure only admin users have access. This will depend on how you identify admins, but it might look something like this (if you are using Devise for authentication):
config.authorize_with do
redirect_to main_app.root_path unless warden.user.admin?
end