Hi I have the following: ***** CODE ***** class DailyStat < ActiveRecord::Base validates_presence_of :player_name, :team, :pos, :gp validates_numericality_of :pts, :plus_minus, :gt, :en, :only_integer => true validates_numericality_of :save_percent validates_uniqueness_of :player_name protected def valdidate errors.add( :pts, "Should be a positive integer." ) if pts.nil? || pts <= 0 errors.add( :gt, "Should be a positive integer." ) if gt.nil? || gt <= 0 errors.add( :en, "Should be a positive integer." ) if en.nil? || en <= 0 end end *** END CODE *** In my form I am able to enter negative numbers in the field and they dont throw errors and are successfully stored into the database. Thanks. -- 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 -~----------~----~----~----~------~----~------~--~---
Jean Nibee
2006-Nov-30 01:16 UTC
Re: my model''s validate() method isn''t being processed.
Ignore this.. I mis-spelled validate(). :/ -- 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 -~----------~----~----~----~------~----~------~--~---