Class: Sunspot::Mongoid::DataAccessor

Inherits:
Adapters::DataAccessor
  • Object
show all
Defined in:
lib/sunspot/mongoid.rb

Instance Method Summary collapse

Instance Method Details

#load(id) ⇒ Object



53
54
55
# File 'lib/sunspot/mongoid.rb', line 53

def load(id)
  @clazz.find(id) rescue nil
end

#load_all(ids) ⇒ Object



57
58
59
# File 'lib/sunspot/mongoid.rb', line 57

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