Class: Sunspot::MongoMapper::Adapters::MongoMapperDataAccessor
- Inherits:
-
Adapters::DataAccessor
- Object
- Adapters::DataAccessor
- Sunspot::MongoMapper::Adapters::MongoMapperDataAccessor
- Defined in:
- lib/sunspot/mongo_mapper/adapters.rb
Instance Attribute Summary collapse
-
#include ⇒ Object
options for the find.
-
#select ⇒ Object
options for the find.
Instance Method Summary collapse
-
#load(id) ⇒ Object
Get one MongoMapper instance out of the database by ID.
-
#load_all(ids) ⇒ Object
Get a collection of MongoMapper instances out of the database by ID.
Instance Attribute Details
#include ⇒ Object
options for the find
23 24 25 |
# File 'lib/sunspot/mongo_mapper/adapters.rb', line 23 def include @include end |
#select ⇒ Object
options for the find
23 24 25 |
# File 'lib/sunspot/mongo_mapper/adapters.rb', line 23 def select @select end |
Instance Method Details
#load(id) ⇒ Object
Get one MongoMapper instance out of the database by ID
Parameters
- id<String>
-
Database ID of model to retreive
Returns
- MongoMapper::Base
-
MongoMapper model
49 50 51 |
# File 'lib/sunspot/mongo_mapper/adapters.rb', line 49 def load(id) @clazz.first(.merge(:id => id)) end |
#load_all(ids) ⇒ Object
Get a collection of MongoMapper instances out of the database by ID
Parameters
- ids<Array>
-
Database IDs of models to retrieve
Returns
- Array
-
Collection of MongoMapper models
64 65 66 |
# File 'lib/sunspot/mongo_mapper/adapters.rb', line 64 def load_all(ids) @clazz.all(.merge(:id => ids)) end |