2010-05-27 62 views
1

我有一個對象elem,我想傳遞給remove_tag_from_cart方法。 這裏是我的嘗試:如何將對象傳遞給:用於link_to_remote調用的字段

-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}} 

:with條款無法正常工作。圖像甚至不顯示。如果我取出:with子句,則鏈接正確顯示並正確調用方法,但我需要elem對象才能將其從cart中刪除。

對此提出建議?

回答

1

價:this

:其中:JavaScript表達式指定用於所述的XMLHttpRequest的參數。任何表達式都應返回有效的URL查詢字符串。

實施例:

嘗試

:with =>"'tag_remove=' + #{elem}" 
相關問題