Class: Unidom::Geo::Locating
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Unidom::Geo::Locating
- Includes:
- Common::Concerns::ModelExtension
- Defined in:
- app/models/unidom/geo/locating.rb
Overview
Locating 是地理定位,表示地理位置和被定位物体之间的关联。
Class Method Summary collapse
Class Method Details
.locate!(location: nil, located: nil, locator: nil, opened_at: Time.now) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'app/models/unidom/geo/locating.rb', line 21 def self.locate!(location: nil, located: nil, locator: nil, opened_at: Time.now) attributes = { opened_at: opened_at } if locator.present? attributes[:locator] = locator else attributes[:locator_id] = Unidom::Common::NULL_UUID attributes[:locator_type] = '' end self.located_is(located).location_is(location).valid_at.alive.first_or_create! attributes end |