Partial data load on :include

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

On 10/9/07, shredluc [email protected] wrote:

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.

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.