I have a partial for a "guest" object which renders a link to a destroy action like this:
<%= link_to_remote "remove", :url => { :action => "destroy", :id => guest.id } %>
When called from an ERB view it works fine, e.g.
<div id="guests">
<%= render :partial => @event.guests %>
That is, it renders something like:
<a href="#" onclick="new Ajax.Request('/guests/destroy/10', {[options removed]}); return false;">remove</a>
The problem is, when this partial is rendered from RJS as a result of a create operation like this:
page.insert_html :bottom, :guests, :partial => @guest
Instead of linking to the destroy action, it links to the detail/show action for the guest instead, e.g.
a href="#" onclick="new Ajax.Request('/events/1/guests/10', {[options removed]}); return false;">remove</a>
Can anyone tell me what I'm doing wrong, or if there's a way to debug what's going on here? As you might be able to tell, I'm a complete newbie to Rails ;)