Validations on a field

hi, i have a model with 2 validations on a field

example:

validates_presence_of :email
validates_length_of :email, :within => 6…100 #removed_email_address@domain.invalid
validates_uniqueness_of :email
validates_format_of :email, :with =>
Authentication.email_regex

if i do the submit of form for a new object of the model with a blank
mail
i receive 4 errors.
In this case i want receive only the errore for:
validates_presence_of :email

is possible?

thanks

Luca R. wrote:

hi, i have a model with 2 validations on a field

example:

validates_presence_of :email
validates_length_of :email, :within => 6…100 #removed_email_address@domain.invalid
validates_uniqueness_of :email
validates_format_of :email, :with =>
Authentication.email_regex

if i do the submit of form for a new object of the model with a blank
mail
i receive 4 errors.
In this case i want receive only the errore for:
validates_presence_of :email

is possible?

thanks

Add , :if => Proc.new { |user| !user.email.blank? } in other validation
except validates_presence_of :email

like
validates_uniqueness_of (:email,:if => Proc.new { |user|
!user.email.blank? })