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

Robustify Rails version checks #689

Merged
merged 1 commit into from
Jan 11, 2024
Merged

Robustify Rails version checks #689

merged 1 commit into from
Jan 11, 2024

Conversation

blaet
Copy link
Contributor

@blaet blaet commented Nov 9, 2023

Ensure Rails versions are properly checked, instead of relying on String comparisons.

Example of why this is an issue

[8] pry(main)> Rails.version > "10.2.3"
=> true
[9] pry(main)> Gem::Version.new(Rails.version) >= Gem::Version.new("10.2.3")
=> false

This example was taken from this comment on a recent PR.

Approach

This change leverages the already existing function Rails.gem_version. This has been part of the Rails codebase for 10+ years, making it compatible with all supported Rails versions.

@blaet blaet mentioned this pull request Nov 9, 2023
Copy link
Contributor

@akostadinov akostadinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@blaet
Copy link
Contributor Author

blaet commented Nov 17, 2023

Fixed a small syntax error. Build should now be 🍏

@blaet
Copy link
Contributor Author

blaet commented Dec 11, 2023

Hi @danielmorrison, any chance you could have a look at this one? Thanks so much! 🚀

@danielmorrison danielmorrison merged commit 4606723 into collectiveidea:main Jan 11, 2024
69 checks passed
@blaet blaet deleted the robustify-rails-version-checks branch January 12, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants