nviennot/nobrainer — pull request #26 by tobymarsden (2013-12-03 10:31:51+00:00)
Title: Uniqueness validations failing with persisted documents

Ran into an issue using uniqueness validations:

```ruby
class Document
include NoBrainer::Document
validates :handle, uniqueness: true
end
```

```ruby
> document = Document.create!(handle: 'my-handle')
=> #

> document.valid?
=> false

> document.errors
=> #, @messages={:handle=>["is already taken"]}>
```

The attached pull request excludes the current document's `id` from the uniqueness validation query if it has already been persisted.