Class: KktShoppe::Customer
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- KktShoppe::Customer
- Defined in:
- app/models/kkt_shoppe/customer.rb
Class Method Summary collapse
- .ransackable_associations(auth_object = nil) ⇒ Object
- .ransackable_attributes(auth_object = nil) ⇒ Object
Instance Method Summary collapse
-
#full_name ⇒ String
The full name of the customer created by concatinting the first & last name.
-
#name ⇒ String
The name of the customer in the format of “Company (First Last)” or if they don’t have company specified, just “First Last”.
Class Method Details
.ransackable_associations(auth_object = nil) ⇒ Object
36 37 38 |
# File 'app/models/kkt_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/kkt_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_name ⇒ String
The full name of the customer created by concatinting the first & last name
28 29 30 |
# File 'app/models/kkt_shoppe/customer.rb', line 28 def full_name "#{first_name} #{last_name}" end |
#name ⇒ String
The name of the customer in the format of “Company (First Last)” or if they don’t have company specified, just “First Last”.
21 22 23 |
# File 'app/models/kkt_shoppe/customer.rb', line 21 def name company.blank? ? full_name : "#{company} (#{full_name})" end |