Class: MongoidAbility::Ability
- Inherits:
-
Object
- Object
- MongoidAbility::Ability
- Includes:
- CanCan::Ability
- Defined in:
- lib/mongoid_ability/ability.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user) ⇒ Ability
constructor
=====================================================================.
Constructor Details
#initialize(user) ⇒ Ability
=====================================================================
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mongoid_ability/ability.rb', line 12 def initialize user @user = user can do |action, subject_type, subject| subject_class = subject_type.to_s.constantize outcome = nil subject_class.self_and_ancestors_with_default_locks.each do |cls| outcome = combined_outcome(user, action, cls, subject) break unless outcome.nil? end outcome end end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
8 9 10 |
# File 'lib/mongoid_ability/ability.rb', line 8 def user @user end |