Class: Ability

Inherits:
Object
  • Object
show all
Includes:
CanCan::Ability
Defined in:
app/models/ability.rb

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ Ability

Returns a new instance of Ability.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/ability.rb', line 8

def initialize(user)
  return unless user

  case user.profile
  when "admin"
    add_admin_abilities
    add_publisher_abilities
    add_contributor_abilities
  when "publisher"
    add_publisher_abilities
    add_contributor_abilities
  when "contributor"
    add_contributor_abilities
  end
end