On Thu, Aug 20, 2009 at 4:34 PM, Rails List < [email protected]> wrote:
> > Karthik Kantharaj wrote: > > hi guys > > > > Thanks for the support you give > > > > I have some four fields which is not mandatory, but when that field is > > entered need to be validated before saved > > else > > it can take null value > > can you please guide me > > -- > > Karthik.k > > Mobile - +91-9894991640 > > Assume that you have an age field that should not be validated if it is > blank. But should be validated when something is entered > > #your Model > > class Employee < ActiveRecord::Base > validates_numericality_of :age, :allow_blank=>true > end > > This will let blank but when something is there it will be validated for > numbers. > > http://www.classifiedscript.in > Craigslist Clone Hi Thank you -- Karthik.k Mobile - +91-9894991640 > -- > 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 -~----------~----~----~----~------~----~------~--~---

