Skip to content

Commit d47b3a9

Browse files
committed
Make Devise.mappings work with lazy loaded routes.
When `Devise.mappings` is called it expects that routes are loaded because mappings is build by `devise_for` call.
1 parent 0f514f1 commit d47b3a9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/devise.rb

+6
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,12 @@ module Test
277277
mattr_reader :mappings
278278
@@mappings = {}
279279

280+
def self.mappings
281+
Rails.application.routes_reloader.try(:execute_unless_loaded)
282+
283+
@@mappings
284+
end
285+
280286
# OmniAuth configurations.
281287
mattr_reader :omniauth_configs
282288
@@omniauth_configs = {}

0 commit comments

Comments
 (0)