Skip to content


:default does not work on custom _id fields #320

darkskiez opened this Issue · 2 comments

3 participants

class IdDefaultBug
    include MongoMapper::Document
    key :_id, String, :default => lambda { rand(1000).to_s }
    key :not_id, String, :default => lambda { rand(1000).to_s }

ruby-1.9.2-p290 :001 >
 => #<IdDefaultBug _id: "4e8326f7098c0431fc000001", not_id: "948">

What version of MongoMapper are you using?


mongomapper 0.9.2
mongo/bson/bson_ext 1.4.1

@cheald cheald added a commit that referenced this issue
@cheald cheald Add specs to cover #402, #403, #320 4f829f0
@cheald cheald closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.