Question: I have a user from that contains the following fields

```
name, email, phone

```

I have added model validations as follows.

```
validates :phone, uniqueness: true
validates :email, confirmation: true

```

If i enter email and submit the form without entering phone number, i get the phone validation error.

But if i submit form without email, none of the validations are working.

This seems to be weird as the validations are working only when there is value on email field.

I want the phone number uniqueness validation to work. But this doesn't seem to work when there is no email entered.

Any idea on what is the real issue?

Answer: 
Add `presence: true` it's making sure email are present or not

```
validates :email, confirmation: true, presence: true

```

It's working when `email` `presence: true`

This check is performed only if email\_confirmation is not nil. To require confirmation, make sure to add a presence check for the confirmation attribute

```
validates :email, confirmation: true
validates :email_confirmation, presence: true

```

See what saying the [Rails Guide](http://guides.rubyonrails.org/active_record_validations.html#confirmation)
You should validate presence of email also. Your email validation should be like this.

`validates :email, presence: true, confirmation: true`

For more details have a look on this page. Thanks 
<https://apidock.com/rails/v4.2.7/ActiveModel/Validations/ClassMethods/validates>