Class: ObjectId

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

Class Method Summary collapse

Class Method Details

.from_mongo(value) ⇒ Object



142
143
144
# File 'lib/mongo_mapper/support.rb', line 142

def self.from_mongo(value)
  value
end

.to_mongo(value) ⇒ Object



132
133
134
135
136
137
138
139
140
# File 'lib/mongo_mapper/support.rb', line 132

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