我已经添加
# config/initializers/will_paginate_array_fix.rb
require 'will_paginate/array'
但似乎仍然没有获得对数组的分页支持,例如:
def index
@array = (1..100).to_a.paginate(params[:page])
end
# gives TypeError: can't convert Symbol into Integer
它适用于模型,我得到
defined? WillPaginate # => constant
ActiveRecord::Base.respond_to? :paginate # => true
# but:
Array.respond_to? :paginate # => false
任何人都知道我缺少什么来获得数组的分页支持?