Created
January 21, 2010 08:41
-
-
Save ahoward/282674 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):004:0> User.count | |
=> 2 | |
irb(main):005:0> User.create(:email => nil) | |
=> #<User _id: 4b581254a047455f06000001, > | |
irb(main):006:0> User.create!(:email => nil) | |
=> #<User _id: 4b581258a047455f06000002, > | |
irb(main):007:0> User.create!(:email => nil) | |
=> #<User _id: 4b58125aa047455f06000003, > | |
irb(main):008:0> User.create!(:email => nil) | |
=> #<User _id: 4b58125ba047455f06000004, > | |
irb(main):009:0> User.count | |
=> 2 | |
# hint - there is a unique index and NO WAY to ask mongoid to raise an error. it simply lies and returns an unsaved object. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment