[Rails] Query multiple models/tables for an "Overview" page
Hey guys. I want to create a overview page for my application that
contains the latest activity on the site, from a few different
sources. Lets say we have messages, comments, files and tasks (much
like Basecamp, if you've ever used it) and you want to display them
all in one big list, intermixed, and sorted by date.
I know I could run queries on all the separate models and then combine
the results, but because this will be paginated, I would end up
getting more records than I really need, and having to trash some,
that seems wasteful and and potentially a hit to performance. So, I'd
really like to be able to put a LIMIT on the DB query itself, as well,
if possible.
What do you think is the best way to go about this? Thanks a lot guys!
--
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@googlegroups.com.
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.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home