will_paginate v3.0: Rails 3, Sinatra and more

After more than a year in making, will_paginate 3.0 is finally out.

Book Heart Bokeh. Notable new features are:

This release is a complete rewrite of will_paginate. It is backwards compatible for the most part, but you should read the document listing all the changes since v2.3 on the wiki.

Install it by adding to your Gemfile:

# Gemfile
gem 'will_paginate', '~> 3.0'

Apart from the usual paginate() method, there is now a new, shorter page() method for pagination that feels more natural when working with Relations:

@posts = Post.where(:published => true).page(1).order('created_at DESC')

What took so goddamned long?

I’m very late in the game releasing a Rails 3 compatible version only now, I admit. The problem was burnout: I tried to make a compatible version when the first Rails 3.0 betas were out, but the codebase was so much in flux back then that the current development version of will_paginate was usually broken again only days after getting it working.

Also, will_paginate 2.3 still supports Rails versions 1.2, 2.0, 2.1, 2.2, and 2.3. So you can imagine the amount of work I did over the years to make the plugin work and fix the test suite every time between all of these Rails releases.

The test suite breakages were always the most depressing and difficult to fix. Over the course of time I grew wary of approaching will_paginate code because I always knew that tons of work awaits me just to make the test run again and then to fix will_paginate functionality to be exactly like before.

That’s why, in this version, I decided to drop support for all old versions of Rails and throw out the complete test suite and start fresh with specs. It wasn’t a small effort. But now it’s done. The result is cleaner code and less hacks to beat Active Record into working.

What’s next for will_paginate

In the next releases I plan to cover the following:

My other projects

I wasn’t slacking in the meantime. When I wasn’t working on will_paginate, I maintained:

So, check out the new will_paginate and these other projects, and happy paginating.