All threads / Refreshing the page with form errors
Ask A Question


You’re not receiving notifications from this thread.

Refreshing the page with form errors

Dainius asked in Rails

Hey all. Currently building a project with rails and so far really enjoying it. I've been using php & laravel for a long time and let me say ruby and rails are quite refreshing.

In laravel when you submit a form and it fails, you are redirected back with errors in the session. So refreshing the page will simply discard the errors from the session, but you stay on that same form page.

In rails, however, you post a form and instead of redirecting back, it display you the previous template. So the URL changes to let's say /users. Refreshing this page will either show me completely different page, or, give me 404 if I don't have index defined.

How do you guys deal with it? Is not a real problem? Personally this is very annoying to me, so I am looking for any workarounds.

Just realised that this is actually a bug in turbolinks, and does not look like it's going to be merged any time soon.

Turbolinks is getting a major update now that was released and I believe is going to fix this. One of their main improvements was to fix the forms.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 68,099+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.