[Rails] Re: validates_format_of with condition

2010-04-17 Thread pepe
validates_format_of :email, :with=>/^[0-9a-za-z_][\w\.-]*[a-za-z0-...@[a-za-z0-9][\w\.-]*[a-za- Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/, :message => "is not valid", :unless => Proc.new { |your_model_name_or_any_variable_name_you_want| your_model_name_or_any_variable_name_you_want

[Rails] Re: validates_format_of with condition

2010-04-17 Thread Priyanka Pathak
Hi, Use allow_blank => true -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email t

[Rails] Re: validates_format_of with condition

2010-04-16 Thread Sharagoz
:allow_nil => true On Apr 16, 4:42 pm, Tushar Gandhi wrote: > Hi, > I am trying to validate the email format by using "validates_format_of". > I have written a code like this:- > "validates_format_of :email, > :with=>/^[0-9a-za-z_][\w\.-]*[a-za-z0-...@[a-za-z0-9][\w\.-]*[a-za-z0-9]\.[a-za-z][a-za

[Rails] Re: validates_format_of with condition

2010-04-16 Thread Ar Chron
Tushar Gandhi wrote: > Hi, > I am trying to validate the email format by using "validates_format_of". > I have written a code like this:- > "validates_format_of :email, > :with=>/^[0-9a-za-z_][\w\.-]*[a-za-z0-...@[a-za-z0-9][\w\.-]*[a-za-z0-9]\.[a-za-z][a-za-z\.]*[a-za-z]$/, >