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

六眼飞鱼酱① 提交于 2019-12-01 08:42:31

问题


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



来源:https://stackoverflow.com/questions/15272095/rails-3-2-and-ransack-is-it-possible-to-pass-additional-params-in-a-sort-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!