简体   繁体   English

Rails link_to-将字符串添加到<a>标签而不是属性</a>

[英]Rails link_to - add string to <a> tag rather than an attribute

I'm trying to turn off link tracking on Mailchimp as described in this article: 我试图按照本文中的说明关闭Mailchimp上的链接跟踪:

https://mandrill.zendesk.com/hc/en-us/articles/205582927-Can-I-disable-click-tracking-on-selected-links-in-my-email- https://mandrill.zendesk.com/hc/zh-CN/articles/205582927-Can-I-disable-click-tracking-on-selected-links-in-my-email-

Essentially, they need me to add a string (for lack of better word, since it's not an attribute) to the a href link, like so 本质上,他们需要我在a href链接中添加一个字符串(由于缺少更好的词,因为它不是属性),因此

Click here to confirm your email address 点击此处确认您的电子邮件地址

app/views/devise/mailer/reset_password_instructions.html.erb app / views / devise / mailer / reset_password_instructions.html.erb

<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %></p>

Neither html_options nor url_options works for this, which i've tried from the documentation here: https://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to html_options和url_options都不适合此操作,我已经在此处的文档中尝试过: https ://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to

Is it possible to do via link_to? 是否可以通过link_to进行?

I wasn't able to find a direct way to fix this. 我找不到解决此问题的直接方法。 So i had to get rid of the link_to and put my ruby code in the href. 因此,我必须摆脱link_to并将红宝石代码放在href中。 Which might look something like this 可能看起来像这样

    <a href= "<%= edit_password_url(@resource, :reset_password_token => @token) %>"  mc:disable-tracking> Change my password</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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