Skip to content
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

Re-define _routes when not set correctly via inheritance #41463

Merged
merged 2 commits into from Feb 16, 2021

Conversation

jhawthorn
Copy link
Member

This fixes a regression where _routes were set incorrectly when the inheritance chain went from one route namespace (isolated engine or main app) to another and then back to the original. Because the url_helpers module was being cached and was being re-included this was not setting _routes.

This commit solves the issue by detecting that case and redefining _routes in that case. We could have always performed the redefinition, but it's a pretty uncommon case, so we might as well only do it when necessary.

Fixes #40263 (includes that commit)
Fixes #40264
Fixes #41458
Fixes #41038

cc @vtamara @inopinatus

@jhawthorn jhawthorn changed the title Isolated engine controller subclasses Re-define _routes when not set correctly via inheritance Feb 16, 2021
jhawthorn and others added 2 commits February 16, 2021 11:55
This fixes an regression where _routes were set incorrectly when the
inheritance chain went from one route namespace (isolated engine or main
app) to another and then back to the original. Because the url_helpers
module was being cached and was being re-included this was not setting
_routes.

This commit solves the issue by detecting that case and redefining
_routes in that case. We could have always performed the redefinition,
but it's a pretty uncommon case, so we might as well only do it when
necessary.
@jhawthorn jhawthorn force-pushed the isolated_engine_controller_subclasses branch from cd402ce to 715d6bc Compare February 16, 2021 19:55
@jhawthorn jhawthorn merged commit 4ef77ac into rails:main Feb 16, 2021
jhawthorn added a commit that referenced this pull request Feb 16, 2021
…ubclasses

Re-define _routes when not set correctly via inheritance
@jhawthorn
Copy link
Member Author

Backported to 6-1-stable in e322277

@jhawthorn jhawthorn deleted the isolated_engine_controller_subclasses branch February 16, 2021 21:31
@inopinatus
Copy link
Contributor

Thanks! I’m glad you found a simpler means than #40264 to inserting the extra module, it felt a little janky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rails 6.1 produces UrlGenerationError with some route helpers of engines that worked fine with Rails 6.0
4 participants