Topic: Trouble using prototype window class (to pass :id to method)

I'm using Prototype window class (http://prototype-window.xilinus.com/index.html) to add some AJAX flavor and eye candy to my interface. I'm using it's rails helper too (http://xurde.info/).
What I'm trying to do is make nice AJAX popups to confirm certain actions. This is working fine on some actions:

<%= link_to_prototype_confirm_url('Remove all expired combinations', 'Are you sure?', 
url_for(:action => 'delete_expired'), nil,
{ :windowParameters => {:className => 'alphacube'} }) %>

... works great, but

<%= link_to_prototype_confirm_url('delete', 'Are you sure?', 
url_for(:action => 'destroy', :id => combination), nil,
{ :windowParameters => {:className => 'alphacube'} }) %>

... doesn't. The difference between both is that in the second case, the record id needs to be passed on too, and it isn't. It doesn't generate an error message or anything, the app keeps working, but the record isn't being deleted.

The generated html looks like this:

<a href="#" onclick="Dialog.confirm( 'Are you sure?',  
{ok: function(){document.location='/combinations/destroy/23';},
windowParameters: {className: 'alphacube'}} ); ">delete</a>

Here's my destroy method (slightly modified to allow ppl to only delete their own combinations):

  def destroy
    Combination.find_by_id_and_user_id(params[:id], session[:user].id).destroy
    redirect_to :action => 'list'
  end

Last edited by Vithu (2006-11-10 18:16:03)