sferik/rails_admin — Issue #830: Cancan works with :manage, :all, but didn't work with :manage, [Person]
Author: tcpipmen
Created: 2011-11-13 15:47:33+00:00
State: open

I 'm having issue with Cancan, where when I configure :manage, :all like shown below then I could login to rails_admin and see all models. But the problem is when limit to specific model like :manage, [Person] then, it doesn't even allow me to login to rails admin. Any help is greatly appreciated.

class Ability
include CanCan::Ability

def initialize(user)
user ||= User.new # guest user
if user && user.admin?
can :access, :rails_admin
if user.role? :admin
can :manage, :all # allow me to login to rails_admin and manage models
end
end
end
end

class Ability
include CanCan::Ability

def initialize(user)
user ||= User.new # guest user
if user && user.admin?
can :access, :rails_admin
if user.role? :admin
can :manage, [Person] # cannot even login to rails_admin
end
end
end
end