Skip to content

Loading…

:default does not work on custom _id fields #320

Closed
darkskiez opened this Issue · 2 comments

3 participants

@darkskiez
#app/models/id_default_bug.rb 
class IdDefaultBug
    include MongoMapper::Document
    key :_id, String, :default => lambda { rand(1000).to_s }
    key :not_id, String, :default => lambda { rand(1000).to_s }
end

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

What version of MongoMapper are you using?

@darkskiez

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.