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
Rails 6.1 produces UrlGenerationError with some route helpers of engines that worked fine with Rails 6.0 #41038
Comments
Thank you for the issue. Since you know which version of Rails this work, and which version of Rails doesn't, can you use git bisect to find which commit changed the behavior you seeing? |
We're seeing the same behaviour under 6.1, its definitely something to do with engines (specifically we're using Administrate), we've yet to get to the bottom of it. The URL helpers available within views sometimes appear not to include the applications own URL helpers but only those of an engine being used. We were able to work around this for now by doing Without looking through the changes yet I'd guess its something relating to this:
Edit: |
Experiencing a similar issue to the original poster. Bisecting shows the tests passing at commit Have tested this with the original poster's example repo and found the same pass/fail result before/at that commit. |
Hi @rafaelfranca is there anything else I can usefully add apart from the bisected commit hash? |
I confirm the result of this bisection of @FlickStuart For me, using |
I could create a much smaller and simple case that shows the problem.
and run it to with rails 6.1 to produce the error:
The following script recreates the situation when using rails 6.1. If you change I wonder how to recreate this case in a test case (?) |
I guess the same problem happens in the |
I can confirm the issue we saw is fixed by the PR #41463 - cheers @jhawthorn 👍🏻 |
Confirming that the issue is solved by using the branch main, that includes the solution of @jhawthorn. |
I'm on 7.0.4 and i seem to have this issue (or a similar one?) Just saying, because the include tip @samuelgiles gave (include MyApplication.routes.url_helpers at the top of ApplicationHelper.) does the trick, or so i though |
Steps to reproduce
test/controllers/rutas_test.rb
withExpected behavior
Passing test as it happens by using Rails 6.0 instead of Rails 6.1. To confirm:
Actual behavior
app/controllers/sip/personas_controller.rb
that is:assert_equal '/heb412/personas', personas_path
that is passing.sip
,mr519_gen
andheb412_gen
see in theGemfile
) all of them hosted in github. The exception is not generated in the test application of the enginesip
(i.e the one available attest/dummy
) neither in the test application of the enginemr519_gen
(which uses the enginesip
). But it can be reproduced in the test application of the engineheb412_gen.
personas_path
is defined in the motorsip
. A workaround is to changepersonas_path
withsip.personas_path
. However that was not required with rails 6.0 (and anyway there are situations where this change cannot be made easily --like withwill_paginate
).app/controllers/sip/personas_controller.rb
already hasinclude Sip::Engine.routes.url_helpers
System configuration
Rails version: 6.1
Ruby version: 2.7.1
The text was updated successfully, but these errors were encountered: