First read about WillPaginate::Finder::ClassMethods, then see WillPaginate::ViewHelpers. The magical array you‘re handling in-between is WillPaginate::Collection.
Happy paginating!
hooks WillPaginate::Finder into ActiveRecord::Base and classes that deal with associations
Enable named_scope, a feature of Rails 2.1, even if you have older Rails (tested on Rails 2.0.2 and 1.2.6).
You can pass false for patch parameter to skip monkeypatching associations. Use this if you feel that named_scope broke has_many, has_many :through or has_and_belongs_to_many associations in your app. By passing false, you can still use named_scope in your models, but not through associations.