gem 'cancancan' bundle install rails g cancan:ability
RailsAdmin.config do |config| config.authorize_with :cancan end
Put the following into app/models/ability.rb:
class Ability include CanCan::Ability def initialize(user) can :read, :all # allow everyone to read everything can :access, :rails_admin # only allow admin users to access Rails Admin can :dashboard can :manage, :all can :history, :all end end
Well, these are just general settings, you have to define them for each user/group later.
class ApplicationController < ActionController::Base rescue_from CanCan::AccessDenied do |exception| redirect_to main_app.root_path, :alert => exception.message end ... end
Okay, it should work now.