Frage

I have setup a nested resource like /projects/1/tasks and want to use sort_link method.

With <%= sort_link @search, :taskname %> i expect /projects/1/tasks?q... but i do get /tasks?q....

Is this possible?

War es hilfreich?

Lösung

You can pass options to the sort_link helper, for example

sort_link @search, :taskname, { :controller => tasks, action: "index", project_id: @project.id }

where options can be anything that is accepted by the url_for helper

see: https://github.com/ernie/ransack/blob/v0.6.0/lib/ransack/helpers/form_helper.rb

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top