Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
An easy way to paginate a list of ActiveRecord objects alphabetically by any given attribute.
Ruby
tag: v0.1.2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.document
.gitignore
LICENSE
README.textile
Rakefile
VERSION
init.rb
install.rb
uninstall.rb

README.textile

PaginateAlphabetically

An easy way to paginate a list of ActiveRecord objects alphabetically by any given attribute.

Example

Model

class User < ActiveRecord::Base
  paginate_alphabetically :by => :surname
end

Controller

class UsersController < ApplicationController
  def index
    @users = User.alphabetical_group(params[:letter])
  end
end

View (haml example)

%ul.pagination
  - User.pagination_letters.each do |letter|
    %li= link_to letter, users_path(:letter => letter)
%ul.users
  - @users.each do |user|
    %li= user.surname

Testing

The tests use a sqlite3 in-memory database to be able to run separately from your application.

rake test

Copyright © 2010 Eden Development, released under the MIT license

Something went wrong with that request. Please try again.