Hi i''m trying to have an eager loading on 4 tables. those tables are : products, store_entries, stores, store_shipping_countries. and i don''t know how to load "store_shipping_countries" in the include parameter when i do a Product.find how can i do it? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jean-sébastien Jney wrote:> Hi > > i''m trying to have an eager loading on 4 tables. > those tables are : > products, store_entries, stores, store_shipping_countries. > and i don''t know how to load "store_shipping_countries" in the include > parameter when i do a Product.find > > how can i do it?prior to rails 2.0 you can use class SomeConroller model :products end don''t know how it 2.0 yet though srry -- Posted via http://www.ruby-forum.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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
i already do a ":through" to access store from product. so i tried in product : has_many :store_shipping_countries, :through => :stores but it doesn''t work. if none can help, i think i will use find_by_sql instead of the regular find On May 17, 5:46 am, Keynan Pratt <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Jean-sébastien Jney wrote: > > Hi > > > i''m trying to have an eager loading on 4 tables. > > those tables are : > > products, store_entries, stores, store_shipping_countries. > > and i don''t know how to load "store_shipping_countries" in the include > > parameter when i do a Product.find > > > how can i do it? > > prior to rails 2.0 you can use > > class SomeConroller > model :products > end > > don''t know how it 2.0 yet though srry > > -- > Posted viahttp://www.ruby-forum.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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi,> i already do a ":through" to access store from product. > so i tried in product : > has_many :store_shipping_countries, :through => :stores > but it doesn''t work. >Assuming you have a relationship called "stores" from product and another called "store_shipping_countries" from stores, then this should work fine. Product.find(:all,:include=>{:stores=>:store_shipping_countries}) Regards, javier ramirez> if none can help, i think i will use find_by_sql instead of the > regular find > > > On May 17, 5:46 am, Keynan Pratt <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > >> Jean-sébastien Jney wrote: >> >>> Hi >>> >>> i''m trying to have an eager loading on 4 tables. >>> those tables are : >>> products, store_entries, stores, store_shipping_countries. >>> and i don''t know how to load "store_shipping_countries" in the include >>> parameter when i do a Product.find >>> >>> how can i do it? >>> >> prior to rails 2.0 you can use >> >> class SomeConroller >> model :products >> end >> >> don''t know how it 2.0 yet though srry >> >> -- >> Posted viahttp://www.ruby-forum.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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---