-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TurboDevisecontroller, TurboFailureApp setup to manage devise respons…
…e formats
- Loading branch information
1 parent
c131432
commit bf5009e
Showing
2 changed files
with
46 additions
and
13 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