通过link_to方法传递集合

时间:2014-07-15 12:59:07

标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-4

我正在尝试通过remote:true方法打开表单。我打开的表单有一个@projects变量。如何通过@projects方法传递此link_to变量。

<%= link_to "", project_path, remote:true, class="icon", id:"icon" %>

1 个答案:

答案 0 :(得分:1)

您可以使用以下代码

<%= link_to "", project_path(:projects => @projects), remote: true, class: "icon", id: "icon" %>

<%= link_to "", project_path(projects: @projects), remote: true, class: "icon", id: "icon" %>