Class: Shoppe::Customer

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ransackable_associations(auth_object = nil) ⇒ Object


36
37
38
# File 'app/models/shoppe/customer.rb', line 36

def self.ransackable_associations(auth_object = nil)
  []
end

.ransackable_attributes(auth_object = nil) ⇒ Object


32
33
34
# File 'app/models/shoppe/customer.rb', line 32

def self.ransackable_attributes(auth_object = nil) 
  ["id", "first_name", "last_name", "company", "email", "phone", "mobile"] + _ransackers.keys
end

Instance Method Details

#full_nameString

The full name of the customer created by concatinting the first & last name

Returns:

  • (String)

28
29
30
# File 'app/models/shoppe/customer.rb', line 28

def full_name
  "#{first_name} #{last_name}"
end

#nameString

The name of the customer in the format of “Company (First Last)” or if they don't have company specified, just “First Last”.

Returns:

  • (String)

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

def name
  company.blank? ? full_name : "#{company} (#{full_name})"
end