Skip to content

Conversation

@rg-victorylive
Copy link

@rg-victorylive rg-victorylive commented Jun 30, 2025

Jira: VP-2057

Important

Toggle to Squash and Merge when merging PRs to staging branch

What

  • Fixnum was merged into Integer in newer Ruby versions. Rails 5 was lenient with this, but Rails 7 requires checking against Integer explicitly.
  • Using 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_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.

Testing

I tested this code by (unit/integration/manual) testing…

Extras

  • Includes a DB migration
  • After merge, requires local environment changes like running bin/build, .env changes etc.
  • Includes UI Changes: add screenshots or videos

(if any are checked, please describe below)

PR Code Coverage

  • Changeset: XX%
  • Overall: XX%

Measure with bin/test_cov or some other means. You can find html coverage levels in coverage/index.html or in stdout.

After a successful test run, you can also see calculated and merged coverage, per branch, on Grafana

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
Copy link
Author

Choose a reason for hiding this comment

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

Fixnum was merged into Integer in newer Ruby versions. Rails 5 was lenient with this, but Rails 7 requires checking against Integer explicitly.

# 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)
Copy link
Author

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants