链接在rails视图中工作正常,但不在电子邮件中[重复](Link works fine in rails view, but not in email [duplicate])

编程入门 行业动态 更新时间:2024-10-27 15:17:00
链接在rails视图中工作正常,但不在电子邮件中[重复](Link works fine in rails view, but not in email [duplicate])

这个问题在这里已有答案:

Rails 3.2`link_to`(在电子邮件中)与`method :: put`仍然产生GET请求 2答案

我正在使用Rails和ActionMailer发送电子邮件

= link_to "Change", update_url( id: @model.id, value1: "data1", :value2 => "data2"), :action => 'update', :method => :put

在Rails视图中,上面的链接工作正常,它到了正确的位置=>更新,但当我将它集成到邮件/电子邮件中时,它会变为“新”。

请问为什么请提示?

This question already has an answer here:

Rails 3.2 `link_to` (in email) with `method: :put` still producing GET request 2 answers

I am using Rails and ActionMailer to send emails

= link_to "Change", update_url( id: @model.id, value1: "data1", :value2 => "data2"), :action => 'update', :method => :put

The above link works fine when in Rails view and it goes to the right place => update, but it goes to "new" when I integrate it into mail/email.

Any tips on why please?

最满意答案

链接正在正确创建,但rails不显眼的javascript句柄实际上使链接执行put请求。 由于电子邮件中不存在此javascript,因此该链接只能发出get请求。

此电子邮件链接通常会链接到edit操作(带有get ),而不是直接执行更改。

The link is being created correctly, but rails unobtrusive javascript handles actually making the link do a put request. Since this javascript doesn't exist in the email, the link will only be able to make a get request.

This email link would more usually link to the edit action (with a get), not actually perform a change directly.

更多推荐

本文发布于:2023-08-06 08:43:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1446730.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视图   电子邮件   链接   工作   rails

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!