Link_to root_path 在邮件视图中不起作用 [英] Link_to root_path not working in mail view

查看:51
本文介绍了Link_to root_path 在邮件视图中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向邮件视图添加一个基本的 link_to 标记.

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

notification.html.erb:

notification.html.erb:

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

错误是未定义的局部变量或方法'root_path' 不太确定为什么相同的代码(仅不同的图像)在普通控制器视图中工作得很好.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.

邮件视图会阻止它吗?

推荐答案

我相信答案是肯定的.我今天早上刚刚在阅读 docs,我的理解是你需要使用 _url 而不是 _path.

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.

这篇关于Link_to root_path 在邮件视图中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆