#Kaminari :: PaginatableArray的未定义方法`page'

时间:2013-09-11 05:13:35

标签: ruby-on-rails-3 ruby-on-rails-3.2 rubygems pagination kaminari

我一直在使用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

1 个答案:

答案 0 :(得分: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)