-
Notifications
You must be signed in to change notification settings - Fork 34
Support current
alias
#1426
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
base: main
Are you sure you want to change the base?
Support current
alias
#1426
Conversation
config/routes.rb
Outdated
@@ -8,7 +8,7 @@ | |||
|
|||
ruby_versions = RubyConfig.ruby_versions.collect { |v| Regexp.escape(v.version) } | |||
|
|||
scope "(:version)", constraints: { version: /#{ruby_versions.join("|")}/ } do | |||
scope "(:version)", constraints: { version: /#{ruby_versions.join("|")}|latest/ } do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since RubyConfig.version_for("current")
would return nil, no other change is needed.
version = RubyConfig.version_for(params[:version]) || RubyConfig.default_ruby_version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to not rely on an unspecified rule as the way to support this feature. It's hard for anyone reading the code for the first time to understand this and it's very easy to break unintentionally. I think we should have a special case for current
and be able to handle it transparently.
Updated to use |
I've not pulled this up locally yet, but do all of the links display as "current" or "3.2" when you pull up "current" documentation? |
As "3.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thoughts @colby-swandale?
I feel this PR is not really complete without this. It's great that we're allowing Could we also have some tests to ensure this feature is working as intended? Thanks. |
This would be great for something like a DuckDuckGo bang to search the docs. FWIW, in that scenario it wouldn't be a problem for me personally if the links referred to the specific version 👍 |
From the suggestion in #1417 (comment)
I thinkcurrent
would be clearer though.latest
might be interpreted as the latest commit onmaster
.Closes #1215