从视图中删除rails trueity token

我预先在@bar的控制器中填充表单字段,当表单在视图中呈现时,它还会在视图中显示authenticity_token

 def new @content = params[:foo][:id] @foo = Foo.find(@content) @bar = Bar.new(title: @foo.title, body: @foo.body, foo_id: @foo.id) end 

Screnshot 在此处输入图像描述

观点代码:

   

Title:

Body:

如何删除视图上呈现的authenticity_token?

在表单中添加以下内容以删除身份validation令牌

:authenticity_token => false

 <%= form_for @bar,:authenticity_token => false do |f| %>