soveran/ohm — pull request #72 by Erol (2012-10-04 03:03:20+00:00)
Title: Ignore nils for unique attributes

With a model:

class User < Ohm::Model
attribute :name
attribute :email
unique :email
end

The following will raise an Ohm::UniqueIndexViolation:

User.create name: 'User 1', email: 'user@domain.com'
User.create name: 'User 2', email: 'user@domain.com'

This will no longer trigger an Ohm::UniqueIndexViolation:

User.create name: 'User 3'
User.create name: 'User 4'

What do you guys think?