使用 link_to_remote 更改数据库状态时出现问题吗?

发布于 2024-08-23 15:37:02 字数 88 浏览 3 评论 0原文

有人知道使用 link_to_remote 更改数据库状态有任何问题吗?我正在考虑有关蜘蛛、谷歌加速器等的问题。Twitter 似乎可以毫无问题地做到这一点。谢谢

anyone know of any issues using a link_to_remote to change the state of the database? I'm taking about issues with spiders, google accelerator etc. Twitter seems to do it with no problem. Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ぇ气 2024-08-30 15:37:02

一般来说,任何只涉及 JavaScript 或使用非 GET 方法的东西都是安全的。 Rails 还有一个与每个 POST 一起发送的特殊字段,以确保表单是由应用程序而不是第三方站点生成的。

这就是为什么在 Rails 2.x 中,销毁方法需要正确路由 DELETE。在此之前,基于 GET 的销毁调用的路径略有不同,并且产生了您所描述的确切问题。

Generally anything engaged only with JavaScript or using a non-GET method is safe from this sort of thing. Rails also has a special field send with each POST to ensure that the form was generated by the application and not a third-party site.

This is why in Rails 2.x the destroy methods require DELETE to be routed properly. Prior to this there were GET-based destroy calls with a slightly different path and that created the exact problems you are describing.

流绪微梦 2024-08-30 15:37:02

我会尝试详细说明。我知道使用 html 链接更改数据库的状态(例如删除文章)是危险的。如果蜘蛛点击该链接,或者谷歌加速器等工具点击该链接,那么该文章将被无意中删除。

我想知道 link_to_remote 链接是否也存在这些问题。 Twitter 使用 ajax 链接来添加或删除搜索,我想知道为什么我上面提到的问题对他们来说不是问题。

I'll try to elaborate. I understand its dangerous to have a html link change the state of the database, for example, delete an article. If a spider follows that link, or a tool such as google accelerator follows that link, then the article will be unintentially deleted.

I was wondering if these problems also exist for a link_to_remote link. Twitter uses an ajax link to add or delete searches, and i was wondering why the issues i mention above were not a problem for them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文