Class: ActiveStash::Search::OrmAdapter
- Inherits:
-
OrmAdapter::Base
- Object
- OrmAdapter::Base
- ActiveStash::Search::OrmAdapter
- Defined in:
- lib/orm_adapter/activestash.rb
Instance Method Summary collapse
Instance Method Details
#find_first(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/orm_adapter/activestash.rb', line 5 def find_first( = {}) cs_fields, db_fields, = () records = nil if db_fields.empty? klass.query(cs_fields) .first else if cs_fields.empty? OrmAdapter::ActiveRecord.new(klass).find_first() else stash_ids = klass.query(cs_fields).map(&:uuid) OrmAdapter::ActiveRecord.new(klass).find_first(db_fields.merge(stash_id: stash_ids)) end end end |
#get(id) ⇒ Object
27 28 29 |
# File 'lib/orm_adapter/activestash.rb', line 27 def get(id) OrmAdapter::ActiveRecord.new(klass).get(id) end |
#get!(id) ⇒ Object
23 24 25 |
# File 'lib/orm_adapter/activestash.rb', line 23 def get!(id) OrmAdapter::ActiveRecord.new(klass).get!(id) end |