我正在尝试进行适当的编辑工作,但遇到了此错误:
ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken)
我知道 Rails 现在想要防止伪造,并且我需要传递表单真实性 token ,但我不清楚如何使用 in_place_edit 插件来做到这一点。
最佳答案
这不是完整测试的答案,但我查看了 plugin code ,看起来您可以使用 :with
选项将真实性 token 附加到请求参数的末尾。大致如下:
in_place_editor("my_element", :with => "form.serialize() + '&authenticity_token=#{form_authenticity_token}';")
(我没有测试过上面的代码)。
关于ruby-on-rails - rails in_place_edit : how do I pass an authenticity token?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/174598/