Class: C::Ability
- Inherits:
-
Object
- Object
- C::Ability
- Includes:
- CanCan::Ability
- Defined in:
- app/models/c/ability.rb
Instance Method Summary collapse
-
#initialize(user) ⇒ Ability
constructor
A new instance of Ability.
Constructor Details
#initialize(user) ⇒ Ability
Returns a new instance of Ability.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/c/ability.rb', line 6 def initialize(user) user ||= C::User.new can :manage, :all if user user..each do || opts = {} opts[:id] = .subject_id if .subject_id can [:read], .subject, opts if .read? can [:new, :create], .subject, opts if .new? can [:edit, :update], .subject, opts if .edit? can [:destroy, :confirm_destroy], .subject, opts if .remove? end end |