-
-
Notifications
You must be signed in to change notification settings - Fork 457
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
url_after_create does not work as expected #793
Comments
Hi @monicao, Did you override the Otherwise, Hope this helps. |
Hi @emilford, Thanks for your response! Ooops, I mistyped. I meant to say "I am trying to override where the user is redirected after logging in." My understanding is that if you define a method called This doesn't seem to work in version 1.16.1. Please see this sample app and the sessions controller test case: https://github.com/monicao/clearance_test |
Hi @monicao, Ah, I see the issue. Clearance's default routes route sign in requests to So while you've created a If you update your routes to override the sign in action to instead route to the This isn't entirely obvious from the documentation. I'm sure thoughtbot would welcome a PR that updates the documentation to clarify this for future users. |
I'm going to close this on the assumption that the last comment resolves this issue for you. Please re-open if that's not the case. |
Hi there!
I am trying to override where the user is redirected after signing up, so according to the docs I defined a method called
url_after_create
, but the controller still redirects:back
.When I override the method for
url_after_destroy
the redirect works as expected.Looking at the code it seems that the problem is the method is using
redirect_back_or url_after_create
instead ofredirect_to url_after_create
https://github.com/thoughtbot/clearance/blob/v1.16.0/app/controllers/clearance/sessions_controller.rb#L25
I am using v1.16.0, but this code is the same in 1.16.1.
If this is indeed a bug, and not a misunderstanding of the docs on my part, I am happy to submit a PR.
The text was updated successfully, but these errors were encountered: