tylere (6) [Avatar] Offline
#1
I would suggest adding the following code to models/ability.rb. This will, if the user is an admin, add a custom cancan block rule that always returns true. This way it isn't necessary to tack on or user.admin? everywhere in permission checks. Is there some downside to this approach that I'm not seeing?

if user.try(:admin?) do
can do |ability,object_class,object|
return true
end
end
ryanbigg (423) [Avatar] Offline
#2
Re: CanCan and admin users
You could do this:

if user.try(:admin?) do
can :manage, :all
end

That should give the user all the permissions in the easiest syntax. There was no reason for doing it the way I did it, other than out of pure habit. We could look at improving this in a future edition.