Files
akkounts/app/controllers/users/devise_controller.rb
T
raucao c79c421b89
CI / Test (pull_request) Successful in 33s
Release Drafter / Update release notes draft (pull_request) Successful in 2s
Fix Devise Turbo Stream responses for flash messages
Wire Users::DeviseController as Devise parent controller with the
Turbo-aware responder, so failed form submissions (login, password
reset) render correctly as HTML with 422 status instead of
unprocessable turbo-stream content that Turbo silently drops.

Also fixes a NameError in the responder (rendering_options ->
error_rendering_options) and removes the dead TurboController.
2026-08-10 16:37:01 -06:00

19 lines
540 B
Ruby

class Users::DeviseController < ApplicationController
class Responder < ActionController::Responder
def to_turbo_stream
controller.render(options.merge(formats: :html))
rescue ActionView::MissingTemplate => error
if get?
raise error
elsif has_errors? && default_action
render error_rendering_options.merge(formats: :html, status: :unprocessable_entity)
else
redirect_to navigation_location
end
end
end
self.responder = Responder
respond_to :html, :turbo_stream
end