Class: VideoAbility

Inherits:
Object
  • Object
show all
Includes:
CanCan::Ability
Defined in:
lib/forge/app/abilities/video_ability.rb

Instance Method Summary collapse

Constructor Details

#initialize(u) ⇒ VideoAbility

Returns a new instance of VideoAbility.



3
4
5
6
7
8
9
10
# File 'lib/forge/app/abilities/video_ability.rb', line 3

def initialize(u)
  if u.is_contributor?
    can([:create, :play], Video)
    can([:update, :destroy, :edit], Video) do |item|
      u.id == item.creator_id
    end
  end
end