Class: Activa::Ability
- Inherits:
-
Object
- Object
- Activa::Ability
- Includes:
- CanCan::Ability
- Defined in:
- app/models/activa/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.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/models/activa/ability.rb', line 7 def initialize(user) user ||= Activa.user_class.new can :read, Activa::Page do |page| user.can_read_activa_page?(page) end can :edit, Activa::Page do |page| user.can_edit_activa_page?(page) end can :create, Activa::Page do |page| user.can_create_activa_page?(page) end can :destroy, Activa::Page do |page| user.can_destroy_activa_page?(page) end end |