bcardarella/client_side_validations — pull request #520 by arr-ee (2013-04-02 20:13:46+00:00)
Title: Added ability to override class name for uniqueness validator

Closes #519

Added `:client_validations` option to the `validate_uniqueness_of`,
where one can specify the real class name for the remote validation.

For example, we have a wrapper class for the User model, UserForm, and
it uses remote uniqueness validation for the email field.

```
class UserForm
include ActiveRecord::Validations
attr_accessor :email
validates_uniqueness_of :email
end
```

However, this won't work since middleware will try to perform validation
against UserForm, and it's not persisted.

Now one can state which class should be used for validation:

```
class UserForm
include ActiveRecord::Validations
attr_accessor :email
validates_uniqueness_of :email, :client_validations => { :class =>
User }
end
```