-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
FIX plataformatec/devise#4127 #4700
Conversation
Hello @a-barbieri, thanks for your pull request. |
Hi @tegon, I manage to create the test. Pretty straight forward. Let me know if it's ok on your side. |
Apparently, fixing the issue generated by the previous PR, brought back an even older issue which led to an infinite loop on Rails 4.2, Ruby 2.2.8 and ActiveRecord ORM. My guess is that tests made on that PR weren't testing the issue properly as several people was complaining afterwards. Therefore, in the test spec, I replaced the Rack app with a Rails Engine to be sure tests are working properly and in fact now we can see them failing. Unfortunately locally I cannot reproduce the error. @tegon, how can I test just the version that fails on Travis locally? I tried copy/pasting the |
@a-barbieri you can use the rbenv local 2.2.8 # or rvm use 2.2.8
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.2-stable bundle install
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.2-stable rake test |
Thanks @tegon, running
was throwing a error:
I managed to make it work adding the local path to Devise repo
Anyway nothing fails.
Can you try on your machine? Or run again Travis to confirm the failure? |
The only thing that I noticed is that there is this message between the dots:
What is the meaning of that? Any hint? |
@a-barbieri Indeed, I triggered another build and this time everything passed. I'll review your PR later, I still need to read the related issues to fully understand the problem. Thanks again for your contribution! |
@a-barbieri I'm trying to understand the issue reproducing it locally and I've some things to share. First, I created a new Engine using the last Rails version (5.2.2) based on that sample app created in the issue. Everything seems to be working using Devise 4.5.0. When the user access the authenticated route, he/she is redirected to the sign in path. See: Notice that the engine app is in the url: After, I tried to run my Engine against this branch but It doesn't work, I got the following error: In the end, I tried to run that sample app) that is on Rails 4.2 using this branch and I got the same error above. Using the last Devise version (4.5.0), I got a different error and I think that's the issue: TL;DRIf I reproduced the issue correctly, the issue only happens on Rails 4.2 and this code didn't fix the problem. |
Hi @tegon, it's been some time since I fixed this issue so I'm trying to catch up from where I left it. When I first came across it I was using Rails 5.1 and 4.3. See #4127 (comment)
You are right. Back then it didn't work because Can you check that You should debug Regarding
Can you just double check that you have a TL;DR If Rails has fixed |
Both
Ohh, I had not the For some reason it works without your patch on Rails 5.2 (even with Here the app that I used to test it: https://github.com/feliperenan/engine-test-app |
Good. I was thinking about changing
As soon as I've got some spare time I'll check what has changed. Meanwhile happy to know both versions are working. |
I think I've found the issue.
Rails 4.2 - router_proxy.rb Debugging Devise with Rails 5.2Debugging into Rails 5.2 app, I can see that context.send(rout, {script_name: nil})
# => "http://localhost:4000/blorgh/users/sign_in"
context.send(rout, {})
# => "http://localhost:4000/blorgh/users/sign_in" The building script name on Rails 5.1+ Debugging Devise with Rails 4.2On the other hand, on Rails 4.2, when context.send(rout, {script_name: nil})
# => "http://localhost:4000/users/sign_in"
context.send(rout, {})
# => "http://localhost:4000/my_engine/users/sign_in" Looking into Rails 4.2 code, on the way, they check if the script_name = find_script_name options
# => "http://localhost:4000/users/sign_in"
options.delete(:script_name)
script_name = find_script_name options
# => "http://localhost:4000/my-engine/users/sign_in" find_script_name call Where context.send is called on Devise codeTL;DRWe should apply your patch considering the change you've mentioned (checking for |
I've been able to fix the issue for #4127 (comment) though I'd like some help to create the test.
It's pretty simple: the engine should point to a directory inside the engine, in order to trigger the redirect. Then the test would be:
@basiszwo, how can I add to your code an internal route
some_route
in order to test it?