What about:

  1) If an overridden accessor is there, (i.e you've defined
Product#price) then that gets called
   2) Otherwise, we call price_before_type_cast

(i.e the opposite of the current logic :))

And we amend the documents.

On 5/22/07, Michael Koziarski <[EMAIL PROTECTED]> wrote:
>
> On 5/23/07, Nik Wakelin <[EMAIL PROTECTED]> wrote:
> >
> > Ah lame I totally just patched this.
> >
> > Maybe we could fix validates_numericality_of? Rather than changing
> > every field helper because of one case? I suppose it is more difficult
> > that way around however.
>
> It's also totally random behaviour to sometimes get a String from an
> otherwise numeric attribute.    I'm not sure that there's a really
> simple fix that'll magically solve every case we could come across,
> but I do believe that if we find the cases where this behaviour is
> biting people, we'll probably be able to solve those cases nicely.
>
> My understanding is that the most common case is something along the
> lines of "I want to store the number of cents instead of a dollar
> amount"?  What else breaks?
>
> It seems the real problem is two fold:
>
> 1) it's kinda surprising that overriding the accessors doesn't
> automatically work
> 2) The docs outright lie and tell you that it will work.
>
> > The docs really do make it seem like it calls the method. So we'd need
> > to remember to change those :)
>
> Indeed.
>
>
> --
> Cheers
>
> Koz
>
> >
>


-- 
Nik Wakelin
(027) 424 5433
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to