Re: [Rails] Re: top 10/most popular lists

2010-05-26 Thread tramuntanal
You can also have a background job that queries all models for top 10 results and save them into top_10 table. This job may refresh the top_10 table once a day for example (late at night?). This way your home page should not perform a lot of expensive queries for each visitor. As Colin Law said opt

Re: [Rails] Re: top 10/most popular lists

2010-05-26 Thread Colin Law
On 25 May 2010 03:15, badnaam wrote: > Thanks! > > Let me clarify. > > On my home page, I would like to show the following > > top 10 clubs in your area > most popular comments in your area > popular events in your area.. > . > . >  and so on. > > This view will essentially show 10-15 records from

[Rails] Re: top 10/most popular lists

2010-05-25 Thread badnaam
Folks, any thoughts? On May 24, 7:15 pm, badnaam wrote: > Thanks! > > Let me clarify. > > On my home page, I would like to show the following > > top 10 clubs in your area > most popular comments in your area > popular events in your area.. > . > . >  and so on. > > This view will essentially sho

[Rails] Re: top 10/most popular lists

2010-05-24 Thread badnaam
Thanks! Let me clarify. On my home page, I would like to show the following top 10 clubs in your area most popular comments in your area popular events in your area.. . . and so on. This view will essentially show 10-15 records from 7-8 models. Which is a lot of queries and of course, its the

[Rails] Re: top 10/most popular lists

2010-05-24 Thread Ritchie
Check out the :counter_cache option of belongs_to. If you order by that and limit to 10, you'll probably have what you're after. /Ritchie On May 25, 12:42 am, badnaam wrote: > What's the best way to handle views that show the top 10/most popular/ > Recently updated/most commented type listing? >