Class: ActsAsAddressable::Location
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ActsAsAddressable::Location
- Defined in:
- app/models/acts_as_addressable/location.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.for_addressable(location) ⇒ Object
10 11 12 |
# File 'app/models/acts_as_addressable/location.rb', line 10 def self.for_addressable(location) where(addressable_id: location.addressable_id).where(addressable_type: location.addressable_type) end |
Instance Method Details
#has_primary? ⇒ Boolean
14 15 16 |
# File 'app/models/acts_as_addressable/location.rb', line 14 def has_primary? !!primary_location_for_addressable end |
#primary_location_for_addressable ⇒ Object
18 19 20 |
# File 'app/models/acts_as_addressable/location.rb', line 18 def primary_location_for_addressable @primary_location_for_addressable ||= Location.primary.for_addressable(self).first end |