Re: Strange numeric validation problem in ActiveRecord

dtrusty-U6r7FCv0h4VBDgjK7y7TUQ@public.gmane.org
Thu, 24 Jan 2008 16:43:01 -0000

On Jan 24, 2:18 am, Keynan Pratt
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:
> What is service_options in mysql (int, float, etc)?
>
> anyways...
>
> validates_numericality_of :replay_limit, :only_integer => true
> --
> Posted viahttp://www.ruby-forum.com/.

The field service_options is int.

Unfortunately, the validates_numericality_of does not work properly.
It does not detect always
invalid data.  I saw indications of bug reports in this area.

I did find the solution however.  I need to use the
<attribute>_before_type_cast method.  In my case,
replay_limit_before_type_cast.
When I use that method, I can see what the user actually entered.

Thanks,

David