inkling
2007-Feb-06 04:33 UTC
Associations: Should "parent" and "parent.children.first.parent" be the exact same object?
Because it''s not, they have totally different object_ids. But should they be pointing to the same object? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Rick Olson
2007-Feb-06 04:41 UTC
Re: Associations: Should "parent" and "parent.children.first.parent" be the exact same object?
On 2/5/07, inkling <nate-UgwZ4owrJFB8UrSeD/g0lQ@public.gmane.org> wrote:> > Because it''s not, they have totally different object_ids. But should > they be pointing to the same object?Should be, assuming the current record is the first child of the parent. However, there''s no identity cache for AR, so they will be different ruby objects. -- Rick Olson http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
inkling
2007-Feb-06 04:49 UTC
Re: Associations: Should "parent" and "parent.children.first.parent" be the exact same object?
Ahh, I wasn''t clear, but you answered my question. Thanks! Yes they point to the same record in the database, but yes I just wanted to make sure it was expected they are different ruby objects. Are there any plans for doing some identity caching in the future or has there been some discussion that it is ideal for "parent" and "parent.children.first.parent" to be different ruby objects? On Feb 5, 10:41 pm, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 2/5/07, inkling <n...-UgwZ4owrJFB8UrSeD/g0lQ@public.gmane.org> wrote: > > > > > Because it''s not, they have totally different object_ids. But should > > they be pointing to the same object? > > Should be, assuming the current record is the first child of the > parent. However, there''s no identity cache for AR, so they will be > different ruby objects. > > -- > Rick Olsonhttp://weblog.techno-weenie.nethttp://mephistoblog.com--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Rick Olson
2007-Feb-06 05:41 UTC
Re: Associations: Should "parent" and "parent.children.first.parent" be the exact same object?
On 2/5/07, inkling <nate-UgwZ4owrJFB8UrSeD/g0lQ@public.gmane.org> wrote:> > Ahh, I wasn''t clear, but you answered my question. Thanks! > > Yes they point to the same record in the database, but yes I just > wanted to make sure it was expected they are different ruby objects. > > Are there any plans for doing some identity caching in the future or > has there been some discussion that it is ideal for "parent" and > "parent.children.first.parent" to be different ruby objects?No plans. There''s been some discussions on it though. Simple identity caches are easy, but it gets pretty complex pretty quickly. It''s usually not a big deal with most web apps I guess. -- Rick Olson http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---