Created
December 23, 2021 08:56
-
-
Save nejdetkadir/18080ba5e1da2d6b22b7cb05a5a555f2 to your computer and use it in GitHub Desktop.
How to use Devise gem with Rails 7 (devise_controller.rb)
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
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 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment