Luca Roma wrote:> hi, i have a model with 2 validations on a field
>
> example:
>
> validates_presence_of :email
> validates_length_of :email, :within => 6..100 #r@a.wk
> 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? })
--
Posted via http://www.ruby-forum.com/.