Save 36% for Black Friday! Save 36% on GoRails for Black Friday! Learn more
Robert Clark
Joined
10 Experience
0 Lessons Completed
0 Questions Solved
Activity
I tried adding the turbo navigational format to devise and unfortunately that did not fix the problem on user destroy for me. What did end up fixing it was modifying the TurboController to match closer to what the responders gem does for other formats.
Look in lib/action_controller/responder.rb#L236-L244 of the responders gem for more context. My fix:
class DeviseTurboController < ApplicationController
class Responder < ActionController::Responder
def to_turbo_stream
if @default_response
@default_response.call(options.merge(formats: :html))
else
controller.render(options.merge(formats: :html))
end
rescue ActionView::MissingTemplate => error
if get?
raise error
elsif has_errors? && default_action
render rendering_options.merge(formats: :html, status: :unprocessable_entity)
else
navigation_behavior error
end
end
end
self.responder = Responder
respond_to :html, :turbo_stream
end
The changes are centered around the default response section. This is where it was getting off the rails on user session destroy for me.