How to pass object in :with field for a link_to_remote call

Posted by mathee on Stack Overflow See other posts from Stack Overflow or by mathee
Published on 2010-05-27T07:58:39Z Indexed on 2010/05/27 8:01 UTC
Read the original article Hit count: 233

Filed under:
|

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

-elem = @tags[1]
#{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?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about AJAX