Class: SocialAbility
- Inherits:
-
Object
- Object
- SocialAbility
- Includes:
- CanCan::Ability
- Defined in:
- app/models/social_ability.rb
Instance Method Summary collapse
-
#initialize(user) ⇒ SocialAbility
constructor
A new instance of SocialAbility.
Constructor Details
#initialize(user) ⇒ SocialAbility
Returns a new instance of SocialAbility.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/social_ability.rb', line 5 def initialize(user) can :create, UserAuthentication do !user.new_record? end can :destroy, UserAuthentication do |user_authentication| user_authentication.user == user end can :read, User do |resource, token| resource == user || resource.token && token == resource.token end can :update, User do |resource, token| resource == user || resource.token && token == resource.token end end |