Forum: Ruby on Rails Passing multiple values with link_to

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
DVG (Guest)
on 2009-04-28 01:57
(Received via mailing list)
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:

<tr>
  <td><%= @user.login %> <small>(<%= link_to "Remove", :action =>
"remove_user_from_group", :id => @group.id, :locals => {:login =>
@user.login} %>)</small></td>
</tr>
Frederick C. (Guest)
on 2009-04-28 02:00
(Received via mailing list)
On Apr 27, 10:57 pm, DVG <removed_email_address@domain.invalid> 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 topic is locked and can not be replied to.