Hello everyone, I am working on a support tool. I have two models, one called Service and another called Issues. A service may have many issues. I then output tables showing what services have what issues. When creating the tables i only need partial data out of the Service and Issues tables. So in other words for each service i want to preload the issues, but only the data i need to use. Otherwise the include takes over 20 seconds to load. If i could specify which columns to preload, it would only load a tenth of the data. Will the rails framework force me to break up the issues table into two? Does anyone have a solution? Thanks, Norbert --~--~---------~--~----~------------~-------~--~----~ 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 10/9/07, shredluc <shredluc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello everyone, > > I am working on a support tool. I have two models, one called Service > and another called Issues. A service may have many issues. I then > output tables showing what services have what issues. When creating > the tables i only need partial data out of the Service and Issues > tables. So in other words for each service i want to preload the > issues, but only the data i need to use. Otherwise the include takes > over 20 seconds to load. If i could specify which columns to preload, > it would only load a tenth of the data. Will the rails framework > force me to break up the issues table into two? Does anyone have a > solution?Two ideas: 1) use find_by_sql and roll your own query that pulls just what you need for the report. 2) create a view in the database that selects a subset of columns from issues, and then define an AR model over that view that you can associate to services. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
shredluc wrote:> tables. So in other words for each service i want to preload the > issues, but only the data i need to use. Otherwise the include takes > over 20 seconds to load. If i could specify which columns to preload, > it would only load a tenth of the data. Will the rails framework > force me to break up the issues table into two? Does anyone have a > solution?There are several solutions at http://dev.rubyonrails.org/ticket/7147 I use http://dev.rubyonrails.org/ticket/7147#comment:12 as a plugin. Warning: experimental, WFM. -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---