Strange numeric validation problem in ActiveRecord

dtrusty-U6r7FCv0h4VBDgjK7y7TUQ@public.gmane.org
Wed, 23 Jan 2008 18:35:43 -0000

Hi,

I am trying to do validation in an ActiveRecord object.

I have a field called replay_limit.  Here is what happens when the web
page user
fills in invalid data into replay_limit (which is declared as an
integer in Mysql):

I do puts in the validate routine to show its class and value.  Note
that it is a Fixnum,
and it has a value of 6.  Yet, the to_yaml shows what the user really
entered: 6#,
which I would like to access in the validate routine, and return an
error.

How can things get in this situation?  How can I get at the real
"string" value of
what the user entered?

self.replay_limit.class = Fixnum
self.replay_limit = 6

--- &id001 !ruby/object:Service
attributes:
  activation_pin: "32990"
  sms_text: ""
  service_options: 32
  moderator_id: "0"
  replay_limit: 6#

Also, why isn''t there quotes around the 6# that to_yaml outputs?

Thanks,

David