Hey Mike,
That looks a valid issue/bug. I''ve pinged Josh about it as he is the
guy in charge of memoization code.
Thanks!
On Sat, Dec 6, 2008 at 9:00 PM, Mike Grafton
<mike-pPy/7Gxx9pKGw+nKnLezzg@public.gmane.org>
wrote:>
> Hey alI,
>
> I like the new support for memoizable methods in Rails 2.2. However,
> I''m running into a problem that''s making it hard to use
in my case.
>
> My ActiveRecord model has a method that does a lot of data crunching,
> and it takes a few seconds. I used ActiveSupport::Memoizable and
> memoized that long-running method, which made my code quite clean
> since I can call it willy-nilly from all over my view. Very nice.
>
> The problem happens when I call #destroy on the model. I didn''t
know
> much about freezing AR objects, so I was surprised when I found out
> that #destroy called #freeze, and #freeze called #memoize_all. This
> calls my long-running method, sadly, which is about the last thing I
> want to happen when destroying my object!
>
> My work-around was to call ModelClass.delete(id), but that''s kinda
> lame given that it doesn''t go through the normal callback cycle -
it
> will surely bite me on the ass someday.
>
> Any other workaround to this problem I don''t see? Besides, of
course,
> rolling my own memoization?
>
> Thanks!
> Mike
>
> >
>
--
Cheers!
- Pratik
http://m.onkey.org
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---