Frank
Frank

Reputation: 189

Passing a collection via link_to method

I am trying to open a form via remote:true method. The form which i am opening has a @projects variable. How can i pass this @projects variable via link_to method.

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

Upvotes: 1

Views: 355

Answers (1)

Deepti Kakade
Deepti Kakade

Reputation: 3203

You can use following code

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

or

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

Upvotes: 1

Related Questions