mongoid/mongoid — pull request #3506 by leemhenson (2014-01-23 23:01:46+00:00)
Title: Uniqueness validator raises NoMethodError instead of Validations error

If you run the spec without applying the change to uniqueness.rb, you'll see that simply running the uniqueness validator explodes if it's validating a nil relation, since it expects to be able to get an ```id``` of it. Instead, it should only try to read ```id``` if the association is not nil, which will then let the validation process fail and raise the normal Validations error.