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



34
35
36
# File 'lib/sunspot/mongoid.rb', line 34

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

#load_all(ids) ⇒ Object



38
39
40
# File 'lib/sunspot/mongoid.rb', line 38

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