I'm still pretty new to Rails and need your help: I have been creating a social fitness analytics site (zednine.com) that has an activity stream that lists workouts posted on the site. Several pages currently show the 10 most recently updated workouts. I'd like to add a link at the bottom to "Older workouts." On click, this should show the next 10 workouts in the page, immediately below the first 10, with a new link to Older below (now 20 displayed in the page) -- just like the news stream on Facebook and several other social networks.
What I've tried so far:
- I'm currently using a find with :limit to get the first N results
- I can set up a unique find with :limit and :offset for each set of N results with hidden divs, but that's lame and does not extend well
I also looked at:
- pagination, including will_paginate, but not clear whether this can help for in same page chunking?
- collections...?
What is the right/a good way to do this?
Also, how can I include records from multiple tables in this sort of stream? E.g., list could include workouts from one table, journal entries from another, comments from a third, all intermixed and sorted by date?
Thank you!