Error in will_paginate gem running Rails 2.1.0

This post was written by Glenn Gentzke. Read other posts by Glenn Gentzke.

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.

About the author: -B.S. in Computer Science from Johns Hopkins University -Web Developer for SmartLogic Solutions, LLC in Baltimore, MD. since 7.07 -Hobbies include writing and playing music, skateboarding and other board sports, motorcycling, traveling locally and abroad, and sampling new beers. -Drummer for One Capital eN, The Eightball Army, Trash Camp, and currently Pfisters Follow me on Twitter

Leave a Reply