Class: Shoppe::Customer
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Shoppe::Customer
- Defined in:
- app/models/shoppe/customer.rb
Constant Summary collapse
- EMAIL_REGEX =
/\A\b[A-Z0-9\.\_\%\-\+]+@(?:[A-Z0-9\-]+\.)+[A-Z]{2,6}\b\z/i
- PHONE_REGEX =
/\A[+?\d\ \-x\(\)]{7,}\z/
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
39 40 41 |
# File 'app/models/shoppe/customer.rb', line 39 def self.ransackable_associations(auth_object = nil) [] end |
.ransackable_attributes(auth_object = nil) ⇒ Object
35 36 37 |
# File 'app/models/shoppe/customer.rb', line 35 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
31 32 33 |
# File 'app/models/shoppe/customer.rb', line 31 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”.
24 25 26 |
# File 'app/models/shoppe/customer.rb', line 24 def name company.blank? ? full_name : "#{company} (#{full_name})" end |