ActionController::InvalidAuthenticityToken 解决办法

解决方法一:在application_controller.rb中增加
skip_before_filter :verify_authenticity_token

解决办法二:修改config/environment/development.rb(或者production.rb)
config.action_controller.allow_forgery_protection = false

解决方法三:在jquery或者form中加入
<%= tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token) %>
posted @ 2021-01-28 09:25  吕兴杰  阅读(489)  评论(0编辑  收藏  举报