问题
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