Class: Unidom::Geo::Location
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Unidom::Geo::Location
- Includes:
- Common::Concerns::ModelExtension
- Defined in:
- app/models/unidom/geo/location.rb
Overview
Location 是地理位置。具体对应到某一个街道地址。
Instance Method Summary collapse
Instance Method Details
#locate!(located, by: nil, at: Time.now) ⇒ Object
31 32 33 |
# File 'app/models/unidom/geo/location.rb', line 31 def locate!(located, by: nil, at: Time.now) locatings.located_is(located).valid_at(now: at).alive.first_or_create! locator: by, opened_at: at end |
#locate?(located, at: Time.now) ⇒ Boolean
38 39 40 |
# File 'app/models/unidom/geo/location.rb', line 38 def locate?(located, at: Time.now) locatings.located_is(located).valid_at(now: at).alive.exists? end |