Class: Comable::Address
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Comable::Address
- Defined in:
- app/models/comable/address.rb
Class Method Summary collapse
Instance Method Summary collapse
- #attributes_without_id ⇒ Object
- #clone ⇒ Object
- #full_address ⇒ Object
- #full_name ⇒ Object
- #same_as?(address) ⇒ Boolean
Class Method Details
.find_or_clone(address) ⇒ Object
14 15 16 |
# File 'app/models/comable/address.rb', line 14 def find_or_clone(address) all.to_a.find { |obj| obj.same_as? address } || address.clone end |
Instance Method Details
#attributes_without_id ⇒ Object
27 28 29 |
# File 'app/models/comable/address.rb', line 27 def attributes_without_id attributes.except('id', 'customer_id') end |
#clone ⇒ Object
23 24 25 |
# File 'app/models/comable/address.rb', line 23 def clone self.class.new(attributes_without_id) end |
#full_address ⇒ Object
35 36 37 |
# File 'app/models/comable/address.rb', line 35 def full_address "#{state_name} #{city} #{detail}" end |
#full_name ⇒ Object
31 32 33 |
# File 'app/models/comable/address.rb', line 31 def full_name "#{family_name} #{first_name}" end |
#same_as?(address) ⇒ Boolean
19 20 21 |
# File 'app/models/comable/address.rb', line 19 def same_as?(address) attributes_without_id == address.attributes_without_id end |