Skip to content

Instantly share code, notes, and snippets.

@qcam
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qcam/86b2b0bcacd6cd19d6fb to your computer and use it in GitHub Desktop.
Save qcam/86b2b0bcacd6cd19d6fb to your computer and use it in GitHub Desktop.
How to customise authorisation rails_admin

How to authorize rails_admin

config.authenticate_with do
  warden.authenticate!
end

config.authorize_with do
  redirect_to main_app.root_path unless current_user.has_role?(:admin)
end

To exclude actions from Model

In your rails_admin.rb

RailsAdmin.config do |config|
  config.actions do 
    new do 
      except ['YourModel']
    end
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment