Fix For Password Archival And Expiration After rails-7 Upgrade#8
Open
rg-victorylive wants to merge 1 commit intomasterfrom
Open
Fix For Password Archival And Expiration After rails-7 Upgrade#8rg-victorylive wants to merge 1 commit intomasterfrom
rg-victorylive wants to merge 1 commit intomasterfrom
Conversation
rg-victorylive
commented
Jun 30, 2025
| unless deny_old_passwords.is_a? Fixnum | ||
| if deny_old_passwords.is_a? TrueClass and archive_count > 0 | ||
| unless deny_old_passwords.is_a?(Integer) | ||
| if deny_old_passwords == true && archive_count > 0 |
Author
There was a problem hiding this comment.
Fixnum was merged into Integer in newer Ruby versions. Rails 5 was lenient with this, but Rails 7 requires checking against Integer explicitly.
rg-victorylive
commented
Jun 30, 2025
| # is an password change required? | ||
| def need_change_password? | ||
| if self.expire_password_after.is_a? Fixnum or self.expire_password_after.is_a? Float | ||
| if self.expire_password_after.respond_to?(:ago) |
Author
There was a problem hiding this comment.
expire_password_after is usually a duration like 365.days, which isn’t a number. Rails 5 handled this loosely, but Rails 7 is stricter. Checking with respond_to?(:ago) ensures it behaves like a duration.
coneybeare
approved these changes
Jun 30, 2025
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.
Jira: VP-2057
Important
Toggle to Squash and Merge when merging PRs to
stagingbranchWhat
is_a?(TrueClass)is not a reliable way to check for true. It caused logic to fail in Rails 7 that used to work in Rails 5.expire_password_afteris usually a duration like 365.days, which isn’t a number. Rails 5 handled this loosely, but Rails 7 is stricter. Checking withrespond_to?(:ago)ensures it behaves like a duration.Testing
I tested this code by (unit/integration/manual) testing…
Extras
bin/build,.envchanges etc.(if any are checked, please describe below)
PR Code Coverage
Measure with
bin/test_covor some other means. You can find html coverage levels incoverage/index.htmlor instdout.After a successful test run, you can also see calculated and merged coverage, per branch, on Grafana