-
-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passwordless route namespace hijacks Rails root_url and other routes #133
Comments
This is due to Passwordless using Your routes should use Feel free to reopen if I'm misunderstanding something. |
Thanks for clarifying! A note in the routes readme section as a reminder would work too. Thanks also for the gem! |
The passwordless route helpers clobber
root_url
and other route helpers inside the/users
namespace.For example, if you have a 'WelcomeController#index' action, configured in routes.rb with passwordless:
If you are inside
app/views/welcome/index.html.erb
and you referenceroot_url
from your sharedapplication.html.erb
layout, you get what you expect:<%= root_url %> <!-- outputs "/" as expected -->
But if you use that same
application.html.erb
layout to render the bundled passwordless views, and try to link back home, you will get/users
prefixed onto ALL OF YOUR ROUTES!For example, if you call
root_url
insideapplication.html.erb
rendered fromapp/views/passwordless/sessions.new.html.erb
you will get AN INCORRECT URL!<%= root_url %> <!-- outputs "/users" incorrectly! -->
The only fix I have found is to NOT use the default
passwordless_for
and instead pass/
to it:Now visiting
/sign_in
does NOT prefix all your routes with/users
includingroot_url
and other helpers.Happy to be corrected if wrong, but I think your routing is clobbering a namespace and should be implemented differently.
Thanks.
The text was updated successfully, but these errors were encountered: