Passing multiple values with link_to

Okay, so I have a many-to-many relationship between Users and Groups.
When looking at the Group, I have the user rows being rendered via a
partial. I want to have a “Remove” link next to each user name in
turn, which calls the “remove user from group” action, but I’m unsure
how exactly to specify this with link_to.

This is what I have:

<%= @user.login %> (<%= link_to "Remove", :action => "remove_user_from_group", :id => @group.id, :locals => {:login => @user.login} %>)

On Apr 27, 10:57 pm, DVG [email protected] wrote:

Okay, so I have a many-to-many relationship between Users and Groups.
When looking at the Group, I have the user rows being rendered via a
partial. I want to have a “Remove” link next to each user name in
turn, which calls the “remove user from group” action, but I’m unsure
how exactly to specify this with link_to.

You can pass as many url parmeters to link_to as you want, eg link_to
‘Remove’, :action => “remove_user_from_group”, :id => @group.id, :foo
=> ‘bar’, :baz => ‘123’

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs