Officialized PaginationHelper #
Regarding the story last week on the PaginationHelper for Rails, its author has updated the code and enhanced documentation. You can still paginate using the Paginator class directly or the helper can automatically paginate.
To automate pagination for all controllers:
class PersonController < ApplicationController
helper :pagination
model :person
paginate :people, :order_by => 'last_name, first_name',
:per_page => 20
end
To automate pagination for a single controller action:
def list
@person_pages, @people =
paginate :people, :order_by => 'last_name, first_name'
end
Sam Stephenson has really done a great job with this release, good of him to take the suggestions from the Paginator I offered last week and mix them up with the variety of other contributions offered by users of this fine Rails helper.
Anyway, it’s new home is here. Well done.


Comments are closed for this entry.