@StatelessCode
  @StatelessCode
Stateless Code | Get Devise Working with Turbo in Rails 7 @StatelessCode | Uploaded November 2022 | Updated October 2024, 3 hours ago.
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 Introduction
00: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 configuration
00:07:02 Demonstrate still no feedback on form errors
00:08:45 Copy controller code from Devise Auth Setup in Rails 7 article for TurboDeviseController and walk through code
00:13:15 Configure the parent_controller to match the TurboDeviseController we just created
00:16:05 Add TurboFailure app and alter Warden configuration to use it
00:18:59 Manually test changes
00:22:35 Add a card to the project to make sure to test unhappy path with system tests
00:24:56 Fix RuboCop offenses
00:28:09 Run tests, push, update issue and project

#ruby #rails7 #rails #rubyonrails #rubygems #codecast #screencast #github #opensource #minitest #TDD #agile #NerdDice #DnD #roleplaying #softwaredevelopment #learntocode #tailwind #postgresql #rubocop #devise #turbo #controllers #gorails #betterprogramming

See other related StatelessCode videos:
- Overview of Authentication Epic and Choosing Devise youtu.be/FbBDmiqRFzI

Resources that we relied upon for this solution:
- Article: Better Programming - Devise Auth Setup in Rails 7 by Nick Francisci https://betterprogramming.pub/devise-auth-setup-in-rails-7-44240aaed4be
- Video: Go Rails - How to use Devise with Hotwire & Turbo.js by Chris Oliver gorails.com/episodes/devise-hotwire-turbo

This video is CC0 - No rights reserved. (YouTube doesn't allow this option when publishing.) All code is released under the UNLICENSE. Stateless Code denies the concept of "intellectual property". Copying is not stealing.
Get Devise Working with Turbo in Rails 7Codecast: Getting Started with Rails 7 26: Fix Rich Text Fixtures and ValidationsInstall Ubuntu 24.04 LTS DesktopMediocre Karaoke - Dust in the Wind by KansasCodecast: Create a RubyGem 86: Retro on Version 0.4.0 (Now with Mediocre Karaoke)Write and Debug Happy Path System Tests for Devise Reset PasswordCodecast: statelesscode.com WordPress 22: Start Styling CommentsCodecast: Getting Started with Rails 7 13: Create Comments for an Article

Get Devise Working with Turbo in Rails 7 @StatelessCode

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER