![](/img/trans.png)
[英]Ruby on Rails: Increase value of object in scaffold with button_to
[英]button_to with image Ruby on Rails
我想放置一個用作按鈕的圖像。 目前我有這個:
<td><%= button_to '+1', upvote_submission_path(submission), method: :post %></td>
這有效,但是,我不知道如何放置一個名為 grayarrow.gif 的圖像而不是“+1”。
您應該能夠像這樣簡單地用image_tag
替換文本:
<td>
<%= button_to(image_tag('grayarrow.gif').html_safe,
upvote_submission_path(submission),
method: :post) %>
</td>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.