-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hacer compatible Devise con Turbo Fix #1
Referencias de la solución https://gorails.com/episodes/devise-hotwire-turbo https://betterprogramming.pub/devise-auth-setup-in-rails-7-44240aaed4be Pull request pendiente que lo hace compatible heartcombo/devise#5340 Solución alternativa propuesta por Devise https://github.com/heartcombo/devise/wiki/Troubleshooting-Rails-7-and-Turbo-Drive
- Loading branch information
1 parent
05749d0
commit 25c15b8
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class TurboDeviseController < 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 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters