Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #cast_primary_key method for mongoid 3

Mongoid 3 no longer relies on bson_ext gem, it uses moped gem
instead, which brings its own version of BSON::ObjectId class
  • Loading branch information...
commit 896c44a3b88049f610c8c2967f9b3ea689ba2405 1 parent 024f282
Jean-Baptiste Barth authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/mongoid-ancestry/instance_methods.rb
2  lib/mongoid-ancestry/instance_methods.rb
View
@@ -229,7 +229,7 @@ def cast_primary_key(key)
if primary_key_type == Integer
key.to_i
elsif primary_key_type == BSON::ObjectId && key =~ /[a-z0-9]{24}/
- BSON::ObjectId.convert(self, key)
+ BSON::ObjectId.from_string(key)
else
key
end
Please sign in to comment.
Something went wrong with that request. Please try again.