Re: Why is FormHelper using value_before_type_cast ?

Francois Beausoleil
Mon, 06 Mar 2006 03:53:45 -0000

2006/3/5, Michael Koziarski
<michael@koziarski.com>:
> See
http://dev.rubyonrails.org/browser/trunk/activerecord/lib/active_record/base.rb#L1561
>
> if you implement your own _before_type_cast methods you should be
> fine.   Why not just define a separate accessor  though,  i.e. one
> used during calculations but not during user input?

I WANT the value to be displayed as 7.50, not 750 !
#***_before_type_cast returns the latter, which is incorrect from the
user's point of view.  He really typed 7.5, but the value is stored as
750, to ensure floating point values are not modified along the way.

So, if I override tax_rate_before_type_cast, I should be all right ?
I'll test this out.

Thanks for the info, Michael.

Bye !