Class: MongoRecord::PKFactory

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

Instance Method Summary collapse

Instance Method Details

#create_pk(row) ⇒ Object



22
23
24
25
26
27
# File 'lib/mongo_record/base.rb', line 22

def create_pk(row)
  return row if row[:_id]
  row.delete(:_id)          # in case it is nil
  row['_id'] ||= BSON::ObjectID.new
  row
end