I made a new pagination library for the NamedScope era.
You can use will_paginate for ordinary case.
It must be better than the young PaginationScope library.
But if you want to paginate with complicated chained named_scopes, this is suitable.
Usage
At first, include the module into your model class.
rails>>
class Post
include PaginationScope
<<--
By this, the scope named "paginate" is made.
And then, in the controller of which you want to use pagination,
you can get the scope for pagination like this.
rails>>
class PostsController < ApplicationController
def index
@posts = Post.not_deleted.paginate(params[:page], 10)
<<--
Finally, the pagination links are generated by calling the view helper, like this.
html>>
<%= paginate @posts %>
<<--
Have fun!
posted by
takiuchi on Sat 16 Aug 2008 at 23:57 with 0 comments