tanya
tanya

Reputation: 2985

link_to - make 2 object values become a link

I need to make a link with the following: '@grp.id -- @grp.captain.name'

I tried the code below:

<%= link_to @[email protected], :controller => :groups, :action => :edit_grp, :id => @grp.id %> 

But am getting the following error message: wrong number of arguments (2 for 0)

My question is how do i make the 2 obj values a link?

Thanks for any suggestion

Upvotes: 1

Views: 80

Answers (1)

Keith Gaddis
Keith Gaddis

Reputation: 4113

<%= link_to "#{@grp.id}--#{@grp.captain.name}", edit_group_path(@grp) %>

should do what you need in any recent version of rails.

Upvotes: 1

Related Questions