Skip to content

Commit 365e01c

Browse files
author
Julian Nadeau
committed
Add Devise.available_router_name to support routing correctly with engines
1 parent 2229ead commit 365e01c

File tree

1 file changed

+6
-1
lines changed
  • lib/two_factor_authentication/controllers

1 file changed

+6
-1
lines changed

lib/two_factor_authentication/controllers/helpers.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,13 @@ def handle_failed_second_factor(scope)
3535

3636
def two_factor_authentication_path_for(resource_or_scope = nil)
3737
scope = Devise::Mapping.find_scope!(resource_or_scope)
38+
namespace = if Devise.available_router_name
39+
send(Devise.available_router_name)
40+
else
41+
self
42+
end
3843
change_path = "#{scope}_two_factor_authentication_path"
39-
send(change_path)
44+
namespace.send(change_path)
4045
end
4146

4247
end

0 commit comments

Comments
 (0)