-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Patch to make Devise compatible with Rails 8
- Loading branch information
1 parent
6a17063
commit 2962fe0
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
# Delete this patch when https://github.com/heartcombo/devise/pull/5728 is released. | ||
|
||
require 'devise' | ||
raise 'Devise is not yet available' unless defined? Devise # make sure it's already loaded | ||
|
||
module Devise | ||
def self.mappings | ||
# Starting from Rails 8.0, routes are lazy-loaded by default in test and development environments. | ||
# However, Devise's mappings are built during the routes loading phase. | ||
# To ensure it works correctly, we need to load the routes first before accessing @@mappings. | ||
Rails.application.try(:reload_routes_unless_loaded) | ||
@@mappings | ||
end | ||
end |