2

I have Rails 4 app. Yesterday, if I had opened a page with a form and my computer stays awake, the next day when I try to submit the form app returns:

500 Internal Error

The log says that authenticity_token is invalid. What can I do?

atw
  • 4,957
  • 9
  • 41
  • 57
mxgoncharov
  • 455
  • 1
  • 7
  • 15

1 Answers1

1

In the method of the form that you are submitting, you could place something like:

if response.status == "500"
  redirect_to "enter a suitable url here"
  raise "Your token has expired."
end

This is an extremely basic solution. If it does not work for you there is a nice question and accepted answer here that you can read up on.

Community
  • 1
  • 1
atw
  • 4,957
  • 9
  • 41
  • 57