vhochstein / active_scaffold

Rails 4 Version of activescaffold supporting jquery
MIT License
156 stars 34 forks source link

NoMethodError - undefined method 'page' #202

Closed guycall closed 11 years ago

guycall commented 11 years ago

I had an old Rails 3.0 app using version 3.0.5 of AS (installed into vendor/plugins). I deleted this and tried the latest 3.0.x gem (i.e. 3.0.30), but got the following error:

NoMethodError (undefined method `page' for #ActiveRecord::Relation:0x9ba6f40):

I went back through all the versions and found the point when this was introduced. 3.0.26 works ok, 3.0.27 has the error.

I get the error even when I remove of the customisations from the activescaffold config block and all code from the model. I even tried stripping Gemfile to a minimum:

source 'http://rubygems.org'
gem 'rails', '3.0.20'
gem 'mysql2', '~> 0.2.7'
gem 'authlogic'
gem 'active_scaffold_vho', '3.0.27' 
guycall commented 11 years ago

If I switch off pagination then it works

config.list.pagination = false
guycall commented 11 years ago

Strangely, if I add kaminari to my Gemfile then the problem goes away.

gem 'kaminari'
vhochstein commented 11 years ago

pagination is done by kaminari so you have to add that dependency to your gemfile...

However, I would have expected that gem system is crying for kaminari during bundle update...

guycall commented 11 years ago

Bundle update does install kaminari and it is in my Gemfile.lock ...

active_scaffold_batch_vho (3.0.6)
  active_scaffold_vho (> 3.0.13)
active_scaffold_vho (3.0.30)
  kaminari
  rails (~> 3.0.0)

... however the app only works if I have kaminari listed in the actual gem file.