LoginSignup
13
15

More than 5 years have passed since last update.

[Rails 4.x] DeviseのControllerをカスタマイズした時に出たエラーへの対処

Last updated at Posted at 2014-10-18

deviseでコントローラーをカスタマイズしていたらエラーがいくつもでたのでその対応をメモします。

ActionController::InvalidAuthenticityToken

以下のように書き換え。

app/controller/application_controller.rb
protect_from_forgery with: :exception

protect_from_forgery with: :null_session

Can't verify CSRF token authenticity

以下を追記。

app/view/*/_form.html.erb
<%= hidden_field_tag :authenticity_token, form_authenticity_token -%>
13
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
15