Module: CanTango::Ability::Helper::User

Defined in:
lib/cantango/ability/helper/user.rb

Instance Method Summary collapse

Instance Method Details

#userObject



3
4
5
6
# File 'lib/cantango/ability/helper/user.rb', line 3

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

#user_key_fieldObject



8
9
10
11
12
# File 'lib/cantango/ability/helper/user.rb', line 8

def user_key_field
  key_field = CanTango.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