Ransack with sort_link for nested resources
I have set up a nested resource for example /projects/1/tasks
and want to use the method sort_link
.
With <%= sort_link @search, :taskname %>
I expect /projects/1/tasks?q...
, but I get /tasks?q...
.
Is it possible?
You can pass parameters to a helper sort_link
like
sort_link @search, :taskname, { :controller => tasks, action: "index", project_id: @project.id }
where options
can be anything that is accepted by the helperurl_for
see below: https://github.com/ernie/ransack/blob/v0.6.0/lib/ransack/helpers/form_helper.rb