Module: WillPaginate

Defined in:
lib/will_paginate.rb,
lib/will_paginate/finders.rb,
lib/will_paginate/version.rb,
lib/will_paginate/collection.rb,
lib/will_paginate/deprecation.rb,
lib/will_paginate/finders/base.rb,
lib/will_paginate/view_helpers.rb,
lib/will_paginate/view_helpers/base.rb,
lib/will_paginate/view_helpers/action_view.rb,
lib/will_paginate/view_helpers/link_renderer.rb,
lib/will_paginate/view_helpers/link_renderer_base.rb,
lib/will_paginate/finders/active_record/named_scope.rb

Overview

borrowed from ActiveSupport::Deprecation

Defined Under Namespace

Modules: Deprecation, Finders, NamedScope, VERSION, ViewHelpers Classes: Collection, InvalidPage

Class Method Summary collapse

Class Method Details

.enableObject

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.



13
14
15
# 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) ⇒ Object

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.



25
26
27
28
29
30
31
# 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