Question

I have been using Kaminari since a while. I use to paginate generic arrays using the following line.

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

That use to work before but I noticed that since yesterday this show the error

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

However calling page on ActiveRecord relation is working fine. something like this is working

User.page(1).per(1)

My Gem file

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'

running bundle show bundle show kaminari gives /Users/***/.rvm/gems/ruby-1.9.3-p448/gems/kaminari-0.14.1

Was it helpful?

Solution

Turned out to be that my colleague has added a configuration file for Kaminari and changed this page function with this line.

config.page_method_name = :kaminari_page

So instead of using Kaminari.paginate_array([1,2,3]).page(1).per(1) I should now use

Kaminari.paginate_array([1,2,3]).kaminari_page(1).per(1)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top