Configure Devise responder for Turbo compatibility#1444
Conversation
Devise 5 supports Turbo-aware status codes natively via responder config. Set error_status to :unprocessable_entity and redirect_status to :see_other so Turbo can handle Devise form responses correctly, and remove the data-turbo=false workarounds from login, confirmation, and welcome forms. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| # Use Turbo-compatible HTTP status codes | ||
| config.responder.error_status = :unprocessable_entity | ||
| config.responder.redirect_status = :see_other | ||
|
|
There was a problem hiding this comment.
These two settings are the native Devise 5 way to enable Turbo compatibility. :unprocessable_entity (422) lets Turbo re-render the form with errors, and :see_other (303) lets Turbo follow redirects on success. This replaces the need for data-turbo=false on every Devise form.
There was a problem hiding this comment.
Just to clarify, it wasn't the upgrade to 5.0 that caused an issue. Devise 4.9 added these new config options to support turbo. Devise will generate these config options for new apps but since we already had devise, we just needed to add them manually.
|
@jmilljr24 fyi i've started to dig in to this. i've got a tournament all day today so if you wanted to pick this up and get it across the finish line, awesome! |
What is the goal of this PR and why is this important?
Follow-up to the Devise 5 upgrade (#1439)Not related to devise upgrade.data-turbo=falseworkarounds or Turbo silently drops error responses (422) and redirects (303)How did you approach the change?
config.responder.error_status = :unprocessable_entityandconfig.responder.redirect_status = :see_otherin the Devise initializerdata: { turbo: false }from the login form, confirmation resend form, and welcome/password-set form since Turbo can now handle these responses nativelyUI Testing Checklist
Anything else to add?
Devise 5Devise 4.9 added native Turbo support viaconfig.responder; this replaces theturbo: falseopt-outs that were added as a stopgap🤖 Generated with Claude Code