简体   繁体   中英

Rails image link_to not working

This is working fine

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

but not this

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

Please tell me how i can make it work.

试试这个,将image_tag和class传递给link_to标签

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM