I’m attempting to render the will_paginate html on the server so I can transplant the entire pager (and some other data) via ajax .
I’ve been able to use
view_context.will_paginate(@posts)
to successfully render the pager in my controller for the ajax call.
Unfortunately, when I run that using format.json, all of my links include the .json format.
/posts.json?page=1
/posts.json?page=2
when they should really be
/posts?page=1
Ideas?
If your using the latest will_paginate gem then you can just create a custom link renderer like so
Make sure you autoload your lib directory in your application.rb
then you can render your pager like so
Hope this helps and happy coding