[Ruby] Ransack の sort_link を nested resources で使う方法

Tadashi Shigeoka ·  Sun, February 24, 2013

Ransack の sort_link を nested resources で使う方法をメモ。

下記のように、hash で controller, action, project_id などを指定します。

sort_link @search, :name, 'タスク名',
  { controller: 'tasks', action: 'index', project_id: @project.id }

[参考]

ruby on rails - Ransack with sort_link for nested resources - Stack Overflow はてなブックマーク - 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 はてなブックマーク - ransack/lib/ransack/helpers/form_helper.rb at v0.6.0 · ernie/ransack · GitHub