Class: Sunspot::Mongoid::DataAccessor

Inherits:
Adapters::DataAccessor
  • Object
show all
Defined in:
lib/generators/tophold_engine/templates/sunspot_mongoid_patch.rb

Instance Method Summary collapse

Instance Method Details

#load(id) ⇒ Object



34
35
36
# File 'lib/generators/tophold_engine/templates/sunspot_mongoid_patch.rb', line 34

def load(id)
  @clazz.criteria.for_ids(Moped::BSON::ObjectId(id))
end

#load_all(ids) ⇒ Object



38
39
40
# File 'lib/generators/tophold_engine/templates/sunspot_mongoid_patch.rb', line 38

def load_all(ids)
  @clazz.criteria.in(:_id => ids.map {|id| Moped::BSON::ObjectId(id)})
end