module WillPaginate

You will paginate!

First read about WillPaginate::Finders::Base, then see WillPaginate::ViewHelpers. The magical array you’re handling in-between is WillPaginate::Collection.

Happy paginating!

borrowed from ActiveSupport::Deprecation

Public Class Methods

enable() click to toggle source

This method used to hook in ActiveRecord and ActionView at load time, but now doesn’t do anything anymore and will be removed in future releases.

# File lib/will_paginate.rb, line 13
def self.enable
  Deprecation.warn "WillPaginate::enable() doesn't do anything anymore"
end
enable_named_scope(patch = true) click to toggle source

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.

# File lib/will_paginate.rb, line 25
def self.enable_named_scope(patch = true)
  return if defined? ActiveRecord::NamedScope
  require 'will_paginate/finders/active_record/named_scope'
  require 'will_paginate/finders/active_record/named_scope_patch' if patch

  ActiveRecord::Base.send :include, WillPaginate::NamedScope
end