Fix validation on uniqueness

In case if I set validation on uniqueness of relation
```ruby
class Foo < ActiveRecord::Base
  belongs_to :bar
  validates :bar, uniqueness: true
end
```

and it doesn't exist, I have an error: 
```
  NoMethodError - undefined method `attributes' for nil:NilClass:
  activerecord (4.0.1.rc4) lib/active_record/validations/uniqueness.rb:56:in `build_relation'
```

To fix it I suggest adding the condition