h2. PaginateAlphabetically
An easy way to paginate a list of ActiveRecord objects alphabetically by any given attribute.
h2. Example
h3. Model
bc. class User < ActiveRecord::Base
paginate_alphabetically :by => :surname
end
h3. Controller
bc. class UsersController < ApplicationController
def index
@users = User.alphabetical_group(params[:letter])
end
end
h3. View (haml example)
bc. = alphabetically_paginate(@users)
%ul.users
- @users.each do |user|
%li= user.surname
h2. Testing
The tests use a sqlite3 in-memory database to be able to run separately from your application.
bc. rake test
Copyright (c) 2010 Eden Development, released under the MIT license