Permalink
Browse files

Merge pull request #13 from antonr/master

uninitialized constant BSON::ObjectId
  • Loading branch information...
2 parents 688430d + 5f5fdd5 commit fb4cf0c701276e7084672e2419999c40e8964cd3 @jugyo committed Sep 2, 2011
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/sunspot/mongoid.rb
View
@@ -32,13 +32,18 @@ def id
class DataAccessor < Sunspot::Adapters::DataAccessor
def load(id)
- @clazz.find(BSON::ObjectID.from_string(id)) rescue nil
+ criteria(id).first
end
def load_all(ids)
- @clazz.where(:_id.in => ids.map { |id| BSON::ObjectId.from_string(id) })
+ criteria(ids)
+ end
+
+ private
+
+ def criteria(id)
+ @clazz.criteria.id(id)
end
-
end
end
end

0 comments on commit fb4cf0c

Please sign in to comment.