Module: CanTango::Ability::UserHelpers
- Included in:
- CanTango::Ability, PermissionEngine, PermitEngine, UserAcEngine
- Defined in:
- lib/cantango/ability/user_helpers.rb
Instance Method Summary collapse
- #user ⇒ Object
- #user_account ⇒ Object (also: #account)
- #user_key_field ⇒ Object
Instance Method Details
#user ⇒ Object
4 5 6 7 |
# File 'lib/cantango/ability/user_helpers.rb', line 4 def user return subject.user if subject.respond_to? :user subject end |
#user_account ⇒ Object Also known as: account
9 10 11 12 |
# File 'lib/cantango/ability/user_helpers.rb', line 9 def user_account return subject.active_account if subject.respond_to? :active_account subject end |
#user_key_field ⇒ Object
15 16 17 18 19 |
# File 'lib/cantango/ability/user_helpers.rb', line 15 def user_key_field key_field = config.user.unique_key_field raise "\nModel <#{user.class}> has no ##{key_field} as defined in CanTango.config.user.unique_key_field" if !user.respond_to?(key_field) key_field end |