⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 will_paginate.rb

📁 敏捷开发 ruby on rails 实现的一个购物车系统
💻 RB
字号:
require 'active_support'# = You *will* paginate!## First read about WillPaginate::Finder::ClassMethods, then see# WillPaginate::ViewHelpers. The magical array you're handling in-between is# WillPaginate::Collection.## Happy paginating!module WillPaginate  class << self    # shortcut for <tt>enable_actionpack; enable_activerecord</tt>    def enable      enable_actionpack      enable_activerecord    end        # mixes in WillPaginate::ViewHelpers in ActionView::Base    def enable_actionpack      return if ActionView::Base.instance_methods.include? 'will_paginate'      require 'will_paginate/view_helpers'      ActionView::Base.class_eval { include ViewHelpers }    end        # mixes in WillPaginate::Finder in ActiveRecord::Base and classes that deal    # with associations    def enable_activerecord      return if ActiveRecord::Base.respond_to? :paginate      require 'will_paginate/finder'      ActiveRecord::Base.class_eval { include Finder }      associations = ActiveRecord::Associations      collection = associations::AssociationCollection            # to support paginating finders on associations, we have to mix in the      # method_missing magic from WillPaginate::Finder::ClassMethods to AssociationProxy      # subclasses, but in a different way for Rails 1.2.x and 2.0      (collection.instance_methods.include?(:create!) ?        collection : collection.subclasses.map(&:constantize)      ).push(associations::HasManyThroughAssociation).each do |klass|        klass.class_eval do          include Finder::ClassMethods          alias_method_chain :method_missing, :paginate        end      end    end  end  module Deprecation #:nodoc:    extend ActiveSupport::Deprecation    def self.warn(message, callstack = caller)      message = 'WillPaginate: ' + message.strip.gsub(/ {3,}/, ' ')      behavior.call(message, callstack) if behavior && !silenced?    end    def self.silenced?      ActiveSupport::Deprecation.silenced?    end  endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -