Get Devise Working with Turbo in Rails 7 - YouTube

As mentioned in the video introducing this epic, Devise does not work correctly with the default Rails 7 configuration of Hotwire (Stimulus and Turbo). In this video we implement some work-arounds mentioned in Devise issues (including 5446, 5513). One way to solve the problem would be to disable Turbo on the forms in the Devise views. Although that's a potenitally viable solution, we decide instead to add a few patches that fix the Turbo issues and allow us to get the app working as intended. All of this is technical debt that we will need to unwind when a viable fix gem version is released, but it solves our problem.This video covers:00:00:12 Introduction00:01:18 Demonstration of the problems (no flash messages, no feedback if you fill out a form incorrectly)00:05:08 Fix flash messages by adding turbo_stream to navigational formats in configuration00:07:02 Demonstrate still no feedback on form errors00:08:45 Copy controller code from Devise Auth Setup in Rails 7 article for TurboDeviseController and walk through code00:13:15 Configure the parent_controller to match the TurboDeviseController we just created00:16:05 Add TurboFailure app and alter Warden configuration to use it00:18:59 Manually test changes00:22:35 Add a card to the project to make sure to test unhappy path with system tests 00:24:56 Fix RuboCop offenses00:28:09 Run tests, push, update issue and project.
Get Devise Working with Turbo in Rails 7 - YouTube #ruby #rubydeveloper #rubyonrails #devise #turbo #youtube https://rubyonrails.ba/single/get-devise-working-with-turbo-in-rails-7-youtube

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles