Class: ObjectId

Inherits:
Object show all
Defined in:
lib/mongo_mapper/support.rb

Class Method Summary collapse

Class Method Details

.from_mongo(value) ⇒ Object



136
137
138
# File 'lib/mongo_mapper/support.rb', line 136

def self.from_mongo(value)
  value
end

.to_mongo(value) ⇒ Object



126
127
128
129
130
131
132
133
134
# File 'lib/mongo_mapper/support.rb', line 126

def self.to_mongo(value)
  if value.nil?
    nil
  elsif value.is_a?(Mongo::ObjectID)
    value
  else
    Mongo::ObjectID.from_string(value.to_s)
  end
end