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 home page, which I wanna
make sure loads fast.

What's the best way to optimize it?

Should I have another model called popular with colums names such as
popular_events, popular_clubs, etc and populate/depopulate that with a
background job? or is there a better way?

Thanks


On May 24, 6:06 pm, Ritchie <[email protected]> wrote:
> 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 <[email protected]> wrote:
>
> > What's the best way to handle views that show the top 10/most popular/
> > Recently updated/most commented type listing?
>
> > Should I have a separate model that is populated with records from
> > other models by a background job or should I need to use some sort of
> > caching? Perhaps both?
>
> > 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 [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to