Module: CanTango::Users::UserAccount

Includes:
Masquerade
Defined in:
lib/cantango/users/user_account.rb

Instance Attribute Summary

Attributes included from Masquerade

#masquerading

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Masquerade

#masquerade_as, #masquerading?, #stop_masquerade

Class Method Details

.included(base) ⇒ Object



18
19
20
# File 'lib/cantango/users/user_account.rb', line 18

def self.included(base)
  CanTango.config.user_accounts.register base.name.underscore.gsub(/_account$/, ''), base
end

Instance Method Details

#active_userObject



6
7
8
# File 'lib/cantango/users/user_account.rb', line 6

def active_user
  @active_user || user
end

#can?(*args) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/cantango/users/user_account.rb', line 10

def can? *args
  CanTango::Ability.new(self).can?(*args)
end

#cannot?(*args) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/cantango/users/user_account.rb', line 14

def cannot? *args
  CanTango::Ability.new(self).cannot?(*args)
end