我想从link_to切换到button_to。
使用link_to我可以将nest和image_tag作为第一个参数。
使用button_to,不是那么容易。我的图像标记以不太好的方式注入输入:
<%= button_to(image_tag("/images/sprite.png"), artist_likes_path(post.artist, :id => post.id, :rating => 1),
:class => 'vote thumb_up',"data-type" => :json, :remote => :true, :method => :post, :id => "like_post_#{post.id}") %>
给出:
<form method="post" action="/artists/joyce_ballantyne/likes?id=29&rating=1" data-remote="true" class="button_to">
<div>
<input class="vote thumb_up" data-type="json" id="like_post_29" type="submit" value="<img alt=" sprite"="" src="/images/sprite.png?1318897720">" />
<input name="authenticity_token" type="hidden" value="p6MA99QfJyQMQRXrwoXD0LxLodVMwnrxg/28ZI3vOHo=">
</div>
</form>
如何将图像精灵放入button_to?