Rails 关于 Devise 的基本问题
在设计中,表单看起来像这样:
form_for(:resource, @resource, :url => edit_user(resource), :html => {:method=> put}) do |f|
但我想知道,它是否必须包含 method =>;放? REST 不是应该已经解决这个问题了吗?
我尝试过使用 form_for(@resource) 但它没有获取编辑用户路径。我想我在这里遗漏了一些东西。任何帮助都会非常有帮助。谢谢!
in devise, the forms look like this:
form_for(:resource, @resource, :url => edit_user(resource), :html => {:method=> put}) do |f|
but I'm wondering, does it have to include method => put? Isn't REST supposed to have taken care of that already?
I've tried using form_for(@resource) but it does not get the edit user path. I think I am missing something here. Any help will be very much helpful. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
其中一篇 Rails 指南讨论了这,这是一个片段:
您可以使用
:html => 填充此隐藏输入{:方法=> put}
这给了 Rails 一些提示。使用此提示和您提交到 Rails 的 URL 可以确定将表单提交到哪个 Restful 操作。阅读我链接到的 Rails 指南,之后事情应该会变得更加清晰。
One of there rails guides talks about this, here is a snippet:
You populate this hidden input using
:html => {:method=> put}
this gives rails a bit of hint. Using this hint and the url you're submitting to rails can work out which of the restful action to submit the form to.Have a read of that rails guide that I linked to, things should become a lot clearer after that.