Search code examples
ruby-on-rails-3.2ransack

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


Solution

  • I have found it !

    Solution :

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

    Cheers