On Thu, Aug 20, 2009 at 4:34 PM, Rails List <
rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---