As our application grows, posts will start to fill up the profile of a user. What happens if our application becomes successful, and people start using it? Hundreds of posts will be printed to the profile view each time the page loads. Something like this could absolutely cripple your application as it starts to grow.
With that in mind, we're going to create some pagination on our profile pages. Our simple pagination system will work as follows:
1. By default, we'll show 10 posts on a page. When a user wants to see more, they'll click on a Load More link.
2. When the Show More link is clicked, jQuery will figure out how many items to skip and tell Bones which documents to retrieve.
3. Bones will use Sag to call CouchDB and get more posts through the
posts_by_user
view.4. Bones will load the results into a partial view that contains our HTML layout for how posts need to be formatted. This HTML will be returned to jQuery to display on our page.
There's quite...