Class: User

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

Instance Method Summary collapse

Methods included from PropMixin

#deserialized_properties, #getProp, #setProp, #set_props

Instance Method Details

#full_nameObject


13
14
15
16
17
18
19
# File 'app/models/user.rb', line 13

def full_name
  if first_name && last_name
    "#{first_name} #{last_name}"
  else
    email_address
  end
end

#last_requested_cartObject


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

def last_requested_cart
  self.requested_carts.order('carts.created_at DESC').first
end

#requested_cartsObject


21
22
23
# File 'app/models/user.rb', line 21

def requested_carts
  self.carts.where(approvals: {role: 'requester'})
end