2015-04-29 31 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") %>