Class: String

Inherits:
Object show all
Defined in:
lib/mongo_record/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#to_oidObject

Convert this String to an ObjectID.



69
70
71
# File 'lib/mongo_record/core_ext.rb', line 69

def to_oid
  BSON::ObjectID.legal?(self) ? BSON::ObjectID.from_string(self) : self
end