On May 15, 9:15 am, Jim Burgess <rails-mailing-l...@andreas-s.net>
wrote:
> Hi,
>
> Is it possible to use standard validation methods in custom validation
> methods?
> eg:
>
> def check_children
> if children != ""
> validates_numericality_of :children
> end
> end
>
> When I run this code I get a no method error:
>
> undefined method `validates_numericality_of' for #<Applicant:0x5d1bba4>
>
> Is there any way around this?
>
Not really. validates_numericality_of is a class method that defines
an appropriate validation on a class. You may find the :allow_nil
and :if or :unless options useful
Fred
> Thanks in advance
> --
> Posted viahttp://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@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---