From 716543fbeaddfa670f6098df6e033edc5efd333e Mon Sep 17 00:00:00 2001 From: Jerome Dalbert Date: Fri, 14 Jun 2024 16:29:27 -0700 Subject: [PATCH] Make test helpers work for deferred routes --- lib/devise/mapping.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/devise/mapping.rb b/lib/devise/mapping.rb index 8b1f94ced..cb4a2316e 100644 --- a/lib/devise/mapping.rb +++ b/lib/devise/mapping.rb @@ -33,7 +33,9 @@ class Mapping #:nodoc: # Receives an object and finds a scope for it. If a scope cannot be found, # raises an error. If a symbol is given, it's considered to be the scope. def self.find_scope!(obj) + Rails.application.try(:reload_routes_unless_loaded) obj = obj.devise_scope if obj.respond_to?(:devise_scope) + case obj when String, Symbol return obj.to_sym