akkounts/app/controllers/turbo_controller.rb
Râu Cao 72ced1d102
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Fix devise not rendering errors as flash messages
https://github.com/heartcombo/devise/issues/5446

closes #63
2022-12-21 19:15:29 +07:00

19 lines
526 B
Ruby

class TurboController < 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