views:

15

answers:

1

I have an object elem that I'd like to pass to the remove_tag_from_cart method. Here is my attempt:

-counter.times do |c|
  -elem = @tags[c]
  #{elem.name}#{link_to_remote image_tag('x.png'), :url => {:controller => 'questions', :action => 'remove_tag_from_cart'}, :with => {:tag_to_remove => :elem}}

The :with clause isn't working correctly. The image does not even show up. If I take out the :with clause, then the link properly shows up and calls the method correctly, but I need the elem object in order to remove it from the cart.

Suggestions?

+1  A: 

Ref: this

:with: A JavaScript expression specifying the parameters for the XMLHttpRequest. Any expressions should return a valid URL query string.

Example:

Try

:with =>"'tag_remove=' + #{elem}"
Salil