Class: Ability
- Inherits:
-
Object
- Object
- Ability
- Includes:
- CanCan::Ability
- Defined in:
- app/models/ability.rb
Instance Method Summary collapse
-
#initialize(user) ⇒ Ability
constructor
A new instance of Ability.
Constructor Details
#initialize(user) ⇒ Ability
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/models/ability.rb', line 6 def initialize(user) user ||= Georgia::User.new if user.has_role? 'Admin' can :manage, :all elsif user.has_role? 'Editor' can :manage, :all cannot :manage, Georgia::User else # or if user is Guest can [:read, :edit, :update, :search, :draft, :review], :all cannot :manage, Georgia::User end end |