Fingertips / peiji-san

PeijiSan is a Rails plugin which uses named scopes to create a thin pagination layer.

This URL has Read+Write access

Manfred (author)
Tue Dec 22 04:16:39 -0800 2009
commit  78d5bad5e04b24f293a9fc94ebe64b41ad37ac30
tree    3744f84fa650d66a6c8fc83059a363649081d91c
parent  9006ff0dd32b98f36fd3f88542410823309d1f40
name age message
file .gitignore Fri Mar 06 07:34:56 -0800 2009 Initial commit to peiji_san. [alloy]
file LICENSE Fri Mar 06 08:22:14 -0800 2009 Imported PeijiSan from svn repo [alloy]
file README.rdoc Tue Dec 22 04:17:58 -0800 2009 Fix the documentation of a few Peiji-san features. [Manfred]
file Rakefile Mon Mar 09 13:56:36 -0700 2009 Forgot rails/init.rb file. Temporarily glob al... [alloy]
file TODO Wed Nov 25 05:23:33 -0800 2009 Added a few TODO's [alloy]
file VERSION.yml Mon Mar 09 13:56:54 -0700 2009 Version bump to 0.1.1 [alloy]
directory lib/ Tue Dec 22 04:17:58 -0800 2009 Fix the documentation of a few Peiji-san features. [Manfred]
file peiji-san.gemspec Mon Mar 09 13:57:03 -0700 2009 Regenerated gemspec for version 0.1.1 [alloy]
directory rails/ Fri Mar 06 08:22:14 -0800 2009 Imported PeijiSan from svn repo [alloy]
directory test/ Fri Mar 06 08:22:14 -0800 2009 Imported PeijiSan from svn repo [alloy]
README.rdoc

Peiji-San

Peiji-San uses named scopes to create a thin pagination layer.

Model:

  class Member < ActiveRecord::Base
    extend PeijiSan
    self.entries_per_page = 32
  end

Controller:

  @collection = Member.active.page(2)

View:

  <% if @collection.page_count > 1 %>
    <% pages_to_link_to(@collection).each do |page %>
      <%= page.is_a?(String) ? page : link_to_page(page, @collection) %>
    <% end %>
  <% end %>