Class: User

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/user.rb

Instance Method Summary collapse

Instance Method Details

#deliver_password_reset_instructions!Object



23
24
25
26
# File 'app/models/user.rb', line 23

def deliver_password_reset_instructions!
  reset_perishable_token!
  UserMailer.deliver_password_reset_instructions(self)
end

#has_role?(role_in_question) ⇒ Boolean

has_role? simply needs to return true or false whether a user has a role or not.

Returns:

  • (Boolean)


29
30
31
32
# File 'app/models/user.rb', line 29

def has_role?(role_in_question)
  @_list ||= self.roles.collect(&:name)
  (@_list.include?(role_in_question.to_s) )
end

#last_addressObject



34
35
36
# File 'app/models/user.rb', line 34

def last_address
  addresses.last
end