Commit eb945aaf13c7fd49444c70bd8f8334076b0129f5
1 parent
471ec8aa
Exists in
master
and in
21 other branches
Fixed mongo id integer issue - closes #124
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
lib/searchkick/model.rb
... | ... | @@ -60,7 +60,9 @@ module Searchkick |
60 | 60 | source = source.inject({}){|memo,(k,v)| memo[k.to_s] = v; memo} |
61 | 61 | |
62 | 62 | # Mongoid 4 hack |
63 | - source["_id"] = source["_id"].to_s if source["_id"] | |
63 | + if defined?(BSON::ObjectId) and source["_id"].is_a?(BSON::ObjectId) | |
64 | + source["_id"] = source["_id"].to_s | |
65 | + end | |
64 | 66 | |
65 | 67 | options = self.class.searchkick_options |
66 | 68 | ... | ... |