Module: CanTango::Ability::UserHelpers

Included in:
CanTango::Ability, PermissionEngine, PermitEngine, UserAcEngine
Defined in:
lib/cantango/ability/user_helpers.rb

Instance Method Summary collapse

Instance Method Details

#userObject



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_accountObject Also known as: account



9
10
11
12
# File 'lib/cantango/ability/user_helpers.rb', line 9

def 
  return subject. if subject.respond_to? :active_account
  subject
end

#user_key_fieldObject



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