-
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
FailureApp
s script_name: nil
breaks route generation within mounted engines
#3705
Comments
Which Rails version are you using? |
Rails 4.2.3. |
@jvdp so apparently if we don't set it, there is a infinite loop. If we set it, we break engines. :( |
Yep, it sucks. Do you think this should be fixed in Rails instead? |
We're running into this as well, with Rails 4.2.4 |
FWIW as a test I deleted this whole bit:
and I did NOT get an infinite loop, everything worked. |
@mmitchellg5 hey if that fixes it, great, but doesn't that break a configuration option? If you can make a PR / fork I'll try it on my app. For completeness I think #3738 is a duplicate of this (and #3739 a proposed fix, but by adding instead of removing code.) |
@jvdp sure does, but you can just delete the conditional since apparently rails 4.2.4 does NOT go into an infinite loop without the setting. |
I think #3738 may be similar but not exactly the same. I just tried disabling the setting of |
@variousred Also no infinite loop issue in Rails 4.2.3 Can anything else be the reason of the bug? (Probably some another modules) |
@josevalim I've submitted PR #3807 that attempts to fix both #3643 and bug it caused above. Despite suggestions to the contrary, there is definitely a infinite loop in cases where mounted engines change the SCRIPT_NAME env variable to be something other than intended path for a given scope. The '/admin/sidekiq' example in #3643 is a perfect example. I don't know enough about the internals, but it would seem something in 4.2 changed to take the SCRIPT_NAME env variable into account in the absence of a :script_name option being passed in. |
Awesome, thanks ofr the PR! |
- Version 3.5.2 includes a bug that causes g5_authenticatable tests to break upon login in - heartcombo/devise#3705 [Fixes #107063598]
- Version 3.5.2 includes a bug that causes g5_authenticatable tests to break upon login in heartcombo/devise#3705 [Fixes #107063598]
- Version 3.5.2 includes a bug that causes g5_authenticatable tests to break upon login in heartcombo/devise#3705 [Fixes #107063598]
- Version 3.5.2 includes a bug that causes g5_authenticatable tests to break upon login in heartcombo/devise#3705 [Fixes #107063598]
Fix infinite loop in authenticated engine routes in Rails 5 #3705
Merged #4081 with a fix for the redirection issue - closing this for now. |
Since upgrading to Devise 3.5.2, the
Devise::FailureApp
from within a Rails engine no longer generates routes with the path it is mounted under.The breaking change was made in aa675f7, which always passes a
script_name
(possibly nil) to the url generator. This is problematic because the mount point path is only computed whenscript_name
is not passed tooptions
: https://github.com/rails/rails/blob/v4.2.3/actionpack/lib/action_dispatch/routing/mapper.rb#L631I'm not sure how to fix this (this is all crazy complicated code), but perhaps there's a better fix for #3643 than forcing
path_name
to be passed tourl_for
.The text was updated successfully, but these errors were encountered: