0

一段时间以来,我一直在使用 Kaminari。我使用以下行对通用数组进行分页。

Kaminari.paginate_array([1,2,3]).page(1).per(1)

以前可以使用,但我注意到从昨天开始这显示错误

 undefined method `page' for #<Kaminari::PaginatableArray:0x007f8e5d10fde0>

然而,关于 ActiveRecord 关系的调用页面工作正常。像这样的东西正在工作

User.page(1).per(1)

我的宝石文件

source 'https://rubygems.org'

ruby '1.9.3'

gem 'rails', '3.2.8'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mysql2'
gem 'pg'

# Ok lets try out the heroku business
gem 'heroku'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-fileupload-rails'

gem 'jquery-rails'
gem 'jquery-ui-rails'
# Twitter Boostrap and Upgrade dependencies
gem 'therubyracer'
gem 'less-rails'
gem 'twitter-bootstrap-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
gem 'unicorn'

# Deploy with Capistrano
gem 'capistrano'
gem 'cap_bootstrap', github: 'benrs44/cap_bootstrap'

gem 'awesome_print'

group :test, :development do
  gem 'rspec-rails', '>= 2.0.1'
  gem "capybara-webkit"
  gem 'capybara'
  gem 'launchy'
  gem 'selenium-webdriver'
  gem 'shoulda-matchers'
  gem 'ci_reporter'
  gem "factory_girl_rails", "~> 4.0"
  # DRb server RSpec
  gem "spork-rails"
  # To use debugger
  gem 'debugger'
end

group :test do
  gem "guard-rspec"
  gem 'rb-fsevent', '~> 0.9.1'
  gem 'database_cleaner'
  gem 'fuubar'
end

#Image Uploader
gem 'carrierwave'

#Image Processor
gem "rmagick"

#Video Processor
gem 'video_info'
gem 'hpricot'

#Authenitcation
gem 'omniauth-facebook', '1.4.0'

#Messaging
gem 'mailboxer', github: 'rralston/mailboxer'
gem 'haml-rails'
gem 'simple_form'

#Gelocation
gem 'geocoder'

#Search
gem 'ransack'

# For easily making nouns possessive
gem 'possessive'

#Pagination
gem "kaminari"
gem 'will_paginate', '~> 3.0'

#Web App Monitoring
gem 'newrelic_rpm'

#FB Style Newsfeeds
gem 'public_activity'

# Heroku CDN Link to AWS
gem "asset_sync"

# Carrier Wave link to AWS S#
gem 'fog', '~> 1.12.1'
gem 'cancan'

# client side validtions
gem 'client_side_validations'

# tagging
gem 'acts-as-taggable-on'

# remote file uploads
gem "remotipart", "~> 1.2.1"

# social sharing
gem 'social-share-button'

gem 'devise', "~> 2.2.3"
gem 'omniauth'
gem 'devise-async'

运行捆绑秀bundle show kaminari给出/Users/***/.rvm/gems/ruby-1.9.3-p448/gems/kaminari-0.14.1

4

1 回答 1

1

原来是同事给Kaminari加了一个配置文件,用这一行改了这个页面功能。

config.page_method_name = :kaminari_page

所以Kaminari.paginate_array([1,2,3]).page(1).per(1)我现在应该使用而不是使用

Kaminari.paginate_array([1,2,3]).kaminari_page(1).per(1)
于 2014-01-18T01:52:46.707 回答