Hello All, newbie but I have one question: If I have a Model ''parent'' and it contains has_many associations to 5 tables. Now once parent object is loaded, all the other has_many associated model also get retrieved which slows down the ''parent'' model load. What do you recommend this in these kinds of scenario? Should disabling has_many option is the only way? Can we avoid this? what would be the best way? Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 1/29/07, Rails junkie <ABoxForTheOtherStuff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello All, > newbie but I have one question: > If I have a Model ''parent'' and it contains has_many associations to 5 > tables. > Now once parent object is loaded, all the other has_many associated > model also get retrieved which slows down the ''parent'' model load. > What do you recommend this in these kinds of scenario? > Should disabling has_many option is the only way? > Can we avoid this? what would be the best way? > ThanksAuto-loading associations does not happen by default. So unless you are using the :include directive you should be fine. Use ./script/console and development.log to verify what is happening. Hope this helps. -- Zack Chandler http://depixelate.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 -~----------~----~----~----~------~----~------~--~---
Great. Will post the findings. Appreciate the response On Jan 29, 5:35 pm, "Zack Chandler" <zackchand...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 1/29/07, Rails junkie <ABoxForTheOtherSt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hello All, > > newbie but I have one question: > > If I have a Model ''parent'' and it contains has_many associations to 5 > > tables. > > Now once parent object is loaded, all the other has_many associated > > model also get retrieved which slows down the ''parent'' model load. > > What do you recommend this in these kinds of scenario? > > Should disabling has_many option is the only way? > > Can we avoid this? what would be the best way? > > ThanksAuto-loading associations does not happen by default. So unless you > are using the :include directive you should be fine. Use > ./script/console and development.log to verify what is happening. > > Hope this helps. > > -- > Zack Chandlerhttp://depixelate.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 -~----------~----~----~----~------~----~------~--~---