Error in will_paginate gem running Rails 2.1.0

I encountered some unexpected errors immediately after upgrading to Rails 2.1.0 from 2.0.2. To replicate the problem:

  1. Choose a model that has_many :things, :through => :something_else, and also uses the will_paginate gem somewhere
  2. open up your console
  3. Model.find(:first).things #=> all your things
  4. Model.find(:first).things.collect(&:id)

=> SystemStackError: stack level too deep

from /usr/lib/ruby/gems/1.8/gems/will_paginate-2.1.0/lib/will_paginate/finder.rb:139:in method\_missing\_without\_paginate'
from /usr/lib/ruby/gems/1.8/gems/will\_paginate-2.1.0/lib/will\_paginate/finder.rb:139:in
method_missing'
from (irb):3

This problem was referenced in this post and the solution is contained therein.

I uninstalled the will_paginate gem and installed the "mislav-will_paginate" gem from http://gems.github.com.
To install it yourself just use:
sudo gem uninstall will_paginate sudo gem install mislav-will_paginate --source=http://gems.github.com

Go back into your console and try it out, then make sure you restart your server for the changes to make it to your app.

Hopefully this helps some of you who are jumping on the latest rails releases, especially after RailsConf just got everyone excited.

comments powered by Disqus