Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3.2 and Ransack - Is it possible to pass additional params in a sort_link?

All is in the title...

Using rails 3.2.11 and Ransack all works fine... I added a functionality to let my users choose the number of items to show per page and it works fine too, but I lose the "per_page" choice when I click on the sort_link

As I can pass additional params to will_paginate like this

<%= will_paginate :params => {:pp => params[:pp]} %>

Is there a way to do the same thing with a Ransack sort_link ?

Cheers

like image 983
phron Avatar asked Oct 30 '25 20:10

phron


1 Answers

I have found it !

Solution :

<th><%= sort_link(@q, :profile_last_name, 'Last name',{:pp => params[:pp]}) %></th>

Cheers

like image 177
phron Avatar answered Nov 02 '25 12:11

phron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!