I'm experiencing problems with the :with clause in the following code.
-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_remove=' + #{elem}"}
If I take out the :with
clause, then remove_tag_from_cart
gets executed when I click on the image link. But, I can't do anything with elem
because it's not being passed to remove_tag_from_cart in any way.
If I leave the :with
clause in there, then remove_tag_from_cart
does not get executed at all!
From my understanding, :with is supposed to enable me to do this in remove_tag_from_cart
:
def remove_tag_from_cart
puts params[:tag_remove].name
end
Again, if I include the :with clause, this method does not run.
What I'd like is to just pass elem
or elem.id
to remove_tag_from_cart
so that I can use it (to find things, etc.). Is this (i.e., passing it using :with) the best/right way to do that? If not, what are my alternatives?