Rails will_paginate links to wrong page

Well,

While setting up a website today I found a bit of retardation in will_paginate. Aside from poor and complicated documentation and an incredible amount of bloat for what amounts to a very simple kind of website component, I found that will_paginate was linking to /?page= on a page that showed in the url bar as /products, so the link should have been /products?page=. So I looked around for a quick fix, and this is the best I got: Revisited: roll your own pagination links with will_paginate and Rails 3

OH MY GAWD. You have to be shitting me. That is hands down the most retarded thing I have ever seen. So, like the little hack monster that I am, I did it faster and easier with less code. If you want to change the pagination links, you can do it with jQuery.

$('div.pagination a').each(function () {
    var url = $(this).attr('href');
    url = url.replace('/','');
    $(this).attr('href',url);
});

Why? Because ideally, will_paginate shouldn’t give a shit about the url, that’s not its job, that’s my job, its job is to ADD get parameters, and manage what those parameters should be, anything else is retarded.

About Jason

I am a 31 year old programmer living in the south of France. I currently work actively in the fields of Ruby/PHP/Javascript and server/website administration.
This entry was posted in Javascript Tutorials, Ruby on Rails, Ruby on Rails, Tips and Tricks, Topics, Tutorials, Web Design and tagged , , . Bookmark the permalink.
  • Patrick McElwee

    Thanks Jason! This is a great little fix for a little problem that was threatening to become a very big headache.

  • Patrick McElwee

    Thanks Jason! This is a great little fix for a little problem that was threatening to become a very big headache.

    • Jason

      Glad I could help bro!

  • Patrick McElwee

    Thanks Jason! This is a great little fix for a little problem that was threatening to become a very big headache.