Sha256: 37999c302e46db289e0d8e6498121764bd901ddf5e79feac7068c3d42c656ff0

Contents?: true

Size: 1.17 KB

Versions: 18

Compression:

Stored size: 1.17 KB

Contents

# = Doozer Paginate
# This code was lifted (i mean...ported) from the WillPaginate gem for ActiveRecord with a few modifications.
#
# Not supported by this plugin but in WillPAginate: 
# * Page numbers between 'Previous' and 'Next' links
# * NamedScopes
#
# See http://wiki.github.com/mislav/will_paginate for more details on useage and license.
require "#{PAGINATE_PLUGIN_ROOT}/paginate/collection"
module Paginate
  class << self
    def enable_activerecord
      return if ActiveRecord::Base.respond_to? :paginate
      require "#{PAGINATE_PLUGIN_ROOT}/paginate/finder"
      ActiveRecord::Base.send :include, Paginate::Finder
    end
    def enable_view_helpers
      # return if Doozer::Initializer.respond_to? :paginate
      require "#{PAGINATE_PLUGIN_ROOT}/paginate/view_helpers"
      Doozer::Controller.send :include, Paginate::ViewHelpers
      Doozer::Partial.send :include, Paginate::ViewHelpers
    end
  end
end

# Enable ActiveRecord if it's defined
Paginate.enable_activerecord if defined? ActiveRecord

# Load the View Helpers if Doozer::Initializer is loaded
Doozer::Initializer.before_rackup do | config |
  Paginate.enable_view_helpers
end if defined? Doozer::Initializer

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
grippy-doozer-0.1.0 lib/doozer/plugins/paginate/lib/paginate.rb
grippy-doozer-0.1.1 lib/doozer/plugins/paginate/lib/paginate.rb
grippy-doozer-0.1.2 lib/doozer/plugins/paginate/lib/paginate.rb
grippy-doozer-0.1.3 lib/doozer/plugins/paginate/lib/paginate.rb
grippy-doozer-0.1.4 lib/doozer/plugins/paginate/lib/paginate.rb
grippy-doozer-0.1.5 lib/doozer/plugins/paginate/lib/paginate.rb
doozer-0.4.4 lib/doozer/plugins/paginate/lib/paginate.rb
doozer-0.4.3 lib/doozer/plugins/paginate/lib/paginate.rb
doozer-0.4.2 lib/doozer/plugins/paginate/lib/paginate.rb
doozer-0.4.1 lib/doozer/plugins/paginate/lib/paginate.rb
doozer-0.4.0 lib/doozer/plugins/paginate/lib/paginate.rb
doozer-0.3.1 lib/doozer/plugins/paginate/lib/paginate.rb
doozer-0.3.0 lib/doozer/plugins/paginate/lib/paginate.rb
doozer-0.2.6 lib/doozer/plugins/paginate/lib/paginate.rb
doozer-0.2.5 lib/doozer/plugins/paginate/lib/paginate.rb
doozer-0.2.2 lib/doozer/plugins/paginate/lib/paginate.rb
doozer-0.2.1 lib/doozer/plugins/paginate/lib/paginate.rb
doozer-0.2.0 lib/doozer/plugins/paginate/lib/paginate.rb