On 24 Aug 2008, at 13:41, "Michael Koziarski" <[EMAIL PROTECTED]>
wrote:
>
>> It's not hard to add this to association collection either. I don't
>> think this approach can be taking any further and it does mean that
>> you can't Marshal.dump what you get out of a find (not sure how much
>> of an issue this is but there are tests around that area).
>
> I'd definitely prefer to use a class we defined rather than the
> metaclass approach, but this is the kind of thing you'll need to do.
>
Sure, just thought it was a fun little hack.
>> I may just be being prematurely paranoid but if find returns a result
>> set object and if the objects in that collection know the result set
>> object (so that for example accessing an association can preemptively
>> load that association for all of them) would you not have the problem
>> that ruby would hold onto the entire result set as long as anyone was
>> holding onto any single object in that collection ?
>
> No you're not being paranoid, if the objects can reach their
> collection (and the have to be able to) then the whole collection will
> stay in memory while any instance is. ORMs which use this approach
> and have large user bases typically have things like the notion of a
> 'detached' object. In this case user's would have to detach those
> objects.
>
> Or you could hold the association to the collection in a WeakRef, but
> I'm not sure how well tested or widely used that class is right now...
>
Thanks for the confirmation. I'll probably try and give this a go as a
plugin ( if it doesn't end up being too much hassle) as it really
sounds like something that would benefit from people being able to
play with it easily
Fred
> There could be some other approach I'm forgetting, but it seems to me
> it's a restriction you'd have to keep in mind.
>> Fred
>>
>>>
>>
>
>
>
> --
> Cheers
>
> Koz
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---