Is it possible to save ActionDispatch :: Session :: SessionRestoreError?

Sometimes interrupting changes raises an ActionDispatch :: Session :: SessionRestoreError exception. It would be great to do something like this to automatically flush invalid sessions:

class ApplicationController < ActionController::Base
  rescue_from ActionDispatch::Session::SessionRestoreError do |exception|
    reset_session
    redirect_to :home
  end
end

This does not work. I assume that the exception occurs at the lower level of the ActionDispatch. Is there a way to repair these errors?

+5
source share
1 answer

He can. A sustainable solution is as follows:

  • Open config/initializers/secret_token.rb
  • Change the value for YourApp::Application.config.secret_token, for example. replacing the last char with something else
  • Restart Rails Server

, , , ( app config), () .

, , .

+7

All Articles