ruby on rails link_to an image

独自空忆成欢 提交于 2019-11-27 21:24:22

There are two approches to this issue.

  1. You must specify the assets folder in the path.

    link_to( image_tag("locale/thumbs/001.jpg"), "/assets/locale/big/spizzicaluna001.jpg" )

  2. Use an image path allowing rails to find the correct image

    link_to( image_tag("locale/thumbs/001.jpg"), image_path( "locale/big/spizzicaluna001.jpg") )

More info on image_path:

http://apidock.com/rails/ActionView/Helpers/AssetTagHelper/image_path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!