Problem inserting parameters in link_to_remote

I want a page that lets users add members to a group
from a longer list, or remove members from that group.
I can use Ajax to transfer a name from the long list
to the group, or drop an existing name from the group.

But.

If I add a person to the group, and try to remove
without refresh, it doesn’t work. My link is formed
by <%= link_to_remote ‘add’, :url => { :action =>
“remove_member”, :id => person.id, :group_id =>
group.id"} %> For a member who’s in the group when I
reach the page, that generates a call to
/controller/remove_member/person.id?group_id=group.id
as it should. But if I add a member ‘foo’ to the
group and then try to remove the same person, the call
is controller/remove_member/foo.id.

I’ve been able to hack around it by setting :id =>
“#{person.id}.{group.id}” in the link_to_remote, but
there’s got to be a better way.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

What you really want to do is read and apply the ideas in this post:
http://www.loudthinking.com/arc/000593.html (straight from the
source). Then read:
http://www.loudthinking.com/lt-files/worldofresources.pdf. Your exact
scenario is shown on page 21. RESTful rocks!

Hope this helps,
Zack