feat(global-edition): prefix generated paths only when not excluded#73444
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Moves the Global Edition (GE) URL generation hook from route helper url_for to Rails’ lower-level ActionDispatch::Http::URL.path_for, so paths are generated normally first and then region/locale prefixes are applied via Cdo::GlobalEdition.path, preserving excluded-path behavior and normalizing existing GE prefixes.
Changes:
- Replace the RouteSet
url_formonkeypatch with aActionDispatch::Http::URL.path_formonkeypatch. - Apply GE prefixing via
Cdo::GlobalEdition.pathafter Rails generates the path. - Update integration tests to reflect new
:script_namebehavior and GE-prefix normalization.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
lib/cdo/global_edition.rb |
Changes the patch point to ActionDispatch::Http::URL.path_for and applies Cdo::GlobalEdition.path to the generated path. |
dashboard/test/integration/global_edition/route_prefix_test.rb |
Updates expectations for :script_name and adds coverage around GE prefix normalization. |
94b3790 to
b2b1906
Compare
b2b1906 to
0a9c7ea
Compare
wilkie
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow-up to the original Global Edition URL generation patch.
The original change added the active Global Edition path prefix by passing it through Rails
:script_nameURL options. That worked for normal route helper generation, but it also meant Rails treated the GE prefix as a script name override rather than as part of the final generated path.This change moves the patch point from
ActionDispatch::Routing::RouteSet#url_fortoActionDispatch::Http::URL.path_for, so Rails generates the path first, and then Global Edition applies the current region prefix throughCdo::GlobalEdition.path.This makes generated paths consistently respect the active Global Edition region while also preserving the existing Global Edition path behavior:
Excluded routes always generate prefixless paths:
Because the final path now goes through
Cdo::GlobalEdition.path, excluded paths are still returned without a GE prefix, and paths that already contain another valid GE region prefix are normalized to the current GE region.Related PR