2013-04-26 26 views
0

我試圖找出如何改變這種代碼:更改IMAGE_TAG到button_to

%li.input.optional= link_to_remove_association image_tag('minus.png', {:alt => "#{t('blabla.remove_model', model: t('activerecord.models.template_instance_right.one'))}"}), f 

使用按鈕來代替。這是我第一次使用Rails,所以我有點迷路。

我想:

=button_to('Remove', {:alt => "#{t('blabla.remove_model', model: t('activerecord.models.template_instance_right.one'))}"}) 

這確實顯示按鈕,但它不會刪除的記錄。

我想我需要使用link_to_remove_association但我不知道如何將它與按鈕本質上結合起來。有任何想法嗎 ?

回答

1

只是button_tag標籤替換image_tag

%li.input.optional= link_to_remove_association button_tag('Remove', {:alt => "#{t('blabla.remove_model', model: t('activerecord.models.template_instance_right.one'))}"}) 
+0

不能相信它是如此容易,非常感謝。 – 2013-04-26 08:46:28