我有一个控制器,其中我有一个自定义操作(不是RESTful集的一部分)来创建一个关联对象。
authenticity_token没有添加到表单中,我认为这是因为操作不是RESTful集的一部分吗?
当authenticity_token不是自动添加时,我将如何添加它?
发布于 2014-05-29 11:46:45
添加
<%= hidden_field_tag "authenticity_token", form_authenticity_token %>以你的身份。
您可以为此做一个帮手:
def authenticity_token_tag
hidden_field_tag "authenticity_token", form_authenticity_token
end然后在你的身体里你可以说
<%= authenticity_token_tag %>https://stackoverflow.com/questions/23932425
复制相似问题