Link_to root_path not working in mail view

痞子三分冷 提交于 2019-12-11 15:25:48

问题


I am trying to add a basic link_to tag to a mail view.

notification.html.erb:

<%= link_to image_tag('S200.gif'), root_path  %>

error is undefined local variable or method 'root_path' Not very sure why as same bit of code (different image only) works perfectly fine in a normal controller view. root_path is correctly set in routes.

Does the mail view prevent it ?


回答1:


I believe the answer is 'yes'. I was just reading the docs this morning, and my understanding is that you need to use _url instead of _path.



来源:https://stackoverflow.com/questions/46820022/link-to-root-path-not-working-in-mail-view

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