Hello again... I am trying to validate date input and i am having a few problems... I have looked at the api and so far i see nothing wrong with my code.. Model: #Validates Length validates_length_of :part_number, :minimun => 5, :message => "Part# must be at least 5 digits!" validates_length_of :work_order, :minimun => 5, :message => "Work Order must be at least 5 digits!" validates_length_of :priority, :in => 1..3, :message => "Priority must be between 1 and 3" EX: Part_number: 12345 Work_order: 12345 priority: 6 This comes back with an error: "private method `split'' called for 6:Fixnum" 6 is the value entered on the priority field... When i comment the priority validation out, no matter what value i enter on the part_number and work_order i get the field highlithed on red. Even when the correct value is entered... Model: #Validates Length validates_length_of :part_number, :minimun => 5, :message => "Part# must be at least 5 digits!" validates_length_of :work_order, :minimun => 5, :message => "Work Order must be at least 5 digits!" #validates_length_of :priority, :in => 1..3, :message => "Priority must be between 1 and 3" EX: Part_number: 12345 Work_order: 12345 priority: 6 Am i missing something...? 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 -~----------~----~----~----~------~----~------~--~---
I suspect that those validation functions are meant to act on strings. Either change to strings or wright a method that validates_size_of -- 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 -~----------~----~----~----~------~----~------~--~---
jamiequint-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-26 18:00 UTC
Re: Validation errors
"minimum" is misspelled On Jan 26, 9:22 am, Ro Vent <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello again... > > I am trying to validate date input and i am having a few problems... I > have looked at the api and so far i see nothing wrong with my code.. > > Model: > #Validates Length > validates_length_of :part_number, :minimun => 5, :message => "Part# > must be at least 5 digits!" > validates_length_of :work_order, :minimun => 5, :message => "Work > Order must be at least 5 digits!" > validates_length_of :priority, :in => 1..3, :message => "Priority > must be between 1 and 3" > > EX: > Part_number: 12345 > Work_order: 12345 > priority: 6 > > This comes back with an error: "private method `split'' called for > 6:Fixnum" > > 6 is the value entered on the priority field... > > When i comment the priority validation out, no matter what value i enter > on the part_number and work_order i get the field highlithed on red. > Even when the correct value is entered... > > Model: > #Validates Length > validates_length_of :part_number, :minimun => 5, :message => "Part# > must be at least 5 digits!" > validates_length_of :work_order, :minimun => 5, :message => "Work > Order must be at least 5 digits!" > #validates_length_of :priority, :in => 1..3, :message => "Priority > must be between 1 and 3" > EX: > Part_number: 12345 > Work_order: 12345 > priority: 6 > > Am i missing something...? > > Thanks > > -- > 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-/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 -~----------~----~----~----~------~----~------~--~---
jamiequint-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> "minimum" is misspelledYeah i saw that and corrected it.. But i think Keynan is right, i think it only works with strings... -- 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 -~----------~----~----~----~------~----~------~--~---
For some reason i cant see the error it reports.... It only puts the red border around the field with the error... No explanation or no message... I followed the tutorial on apple''s site and they only show that they put the validation lines and it displayed the whole message explaining why it failed... Any thoughts..? 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 -~----------~----~----~----~------~----~------~--~---