2015-04-29 32 views
0

這是工作的罰款Rails的圖像LINK_TO不工作

<%= link_to "up.png", voteup_path(post_id: post.id, topic_id: post.topic_id), class: "xta" %> 

但不是這個

<%= link_to image_tag("up.png"), voteup_path(post_id: post.id, topic_id: post.topic_id), class: "xta" %> 

請告訴我如何我可以做它的工作。

+1

嘗試這種'<(%)=的link_to(IMAGE_TAG( 「up.png」),voteup_path(POST_ID:post.id,topic_id:post.topic_id ),class:「xta」)%>' – Sontya

+0

@Sontya感謝它的工作:)。請回答,以便我可以標記它正確 – Adt

+0

很高興它爲你工作,添加爲答案 – Sontya

回答

4

嘗試此,通過image_tag和類link_to標籤

<%=link_to(image_tag("up.png"),voteup_path(post_id: post.id, topic_id: post.topic_id), class: "xta") %>