We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6a17063 commit 2962fe0Copy full SHA for 2962fe0
config/initializers/devise_rails8_patch.rb
@@ -0,0 +1,16 @@
1
+# frozen_string_literal: true
2
+
3
+# Delete this patch when https://github.com/heartcombo/devise/pull/5728 is released.
4
5
+require 'devise'
6
+raise 'Devise is not yet available' unless defined? Devise # make sure it's already loaded
7
8
+module Devise
9
+ def self.mappings
10
+ # Starting from Rails 8.0, routes are lazy-loaded by default in test and development environments.
11
+ # However, Devise's mappings are built during the routes loading phase.
12
+ # To ensure it works correctly, we need to load the routes first before accessing @@mappings.
13
+ Rails.application.try(:reload_routes_unless_loaded)
14
+ @@mappings
15
+ end
16
+end
0 commit comments