[Ruby] How to Use Ransack's sort_link with Nested Resources

Tadashi Shigeoka ·  Sun, February 24, 2013

Here’s a memo on how to use Ransack’s sort_link with nested resources.

As shown below, specify controller, action, project_id, etc. in a hash.

sort_link @search, :name, 'Task Name',
  { controller: 'tasks', action: 'index', project_id: @project.id }

[Reference]

ruby on rails - Ransack with sort_link for nested resources - Stack Overflow

ransack/lib/ransack/helpers/form_helper.rb at v0.6.0 · ernie/ransack · GitHub

That’s all from the Gemba.