-->

Rails 3.2 and Ransack - Is it possible to pass add

2019-02-19 07:40发布

问题:

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

回答1:

I have found it !

Solution :

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

Cheers