Explicit path matching and path params for Pages#27
Merged
sbsoftware merged 2 commits intoreleases/v0.29.0from Jan 1, 2026
Merged
Explicit path matching and path params for Pages#27sbsoftware merged 2 commits intoreleases/v0.29.0from
sbsoftware merged 2 commits intoreleases/v0.29.0from
Conversation
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.
The previous path matching defaults for
Pages was flawed as it always matched a resource-like path both with and without an ID path parameter, like it is forResources. The issue is that aPageonly supports a single view, so it cannot be responsible for an index and a detail view of a resource at the same time. If you want to serve two kinds of pages, you'll have to create twoPagesub-classes or use aResource.With these changes, the default behavior of a
Pageis to just match the exact path derived from the path name (LegalNoticePage->/legal_notice). This can be altered/extended via three macros:root_pathroot_path "/foo")path_parampath_param :id, /\d+/) and the end of the currently defined pathPagenested_pathExample:
PostsPagewill then match paths of this kind:/posts/123/comments, with"123"begin returned by an#idmethod in the context of the page instance.