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



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

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

#load_all(ids) ⇒ Object



60
61
62
# File 'lib/sunspot/mongoid.rb', line 60

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