duck_punching

Ruby, Rails and tech. No ducks were harmed in the making of this blog.

Pagination for make_resourceful

Hampton Catlin the creator of make_resourceful has let his thoughts on pagination known and in summary he is not a fan. Hence there is no DRY way to add pagination to m_r without overriding the defaults methods repeatedly.

I am not so anti pagination and often find it mildly useful. But mostly my clients want it regardless. So I have abtracted my pagination solution for m_r into a plugin called funnily enough make_resourceful_with_pagination. Now it may sound like a fork of m_r but it is in fact an “evil-twin” plugin, which is a plugin pattern invented by Chris Wanstrath of GitHub. So basically you need to install both m_r and my plugin.

It works with will_paginate by default but should also work with paginating_find or any pagination that acts on the model. You just need to tweak the global options. It won’t work with classic pagination, but frankly I don’t see the appeal of that anyway.

1 comment

1 Comment so far

  1. Aces July 15th, 2012 3:24 pm

    Thanks for the marvelous posting! I quite enjoyed reading it,
    you will be a great author. I will be sure to bookmark your blog and will eventually come back very soon.
    I want to encourage yourself to continue your great writing,
    have a nice weekend!

Leave a reply

Mexico