Amazing! thanks Gianluca :DD!!

Luis

Gianluca Tessarolo wrote:
> Yes, validating format only when field has a value:
> 
> ex.
> 
> validates_format_of :field, :with => "xxxx", :allow_blank => true
> 
> :allow_nil - If set to true, skips this validation if the attribute is
> nil (default is false)
> :allow_blank - If set to true, skips this validation if the attribute is
> blank (default is false)
> 
> or
> validates_format_of :field, :with => "xxxx", :if => Proc.new{|record|
> !record.field.blank? }
> but the first one is better (allow_blank), with the last one u can make
> a validation based on more than one field...
> 
> Hope this helps...

-- 
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to