Skip to content

Conversation

floehopper
Copy link
Contributor

Previously this method returned either 0 or nil. This works fine in Ruby, because 0 is truth-y, but it causes problems if you want to persist the value in a Postgres boolean type, because 0 is cast to FALSE. The new implementation always returns either true or false.

This will mean we can remove this workaround in experience-cs.

Copy link

github-actions bot commented Aug 18, 2025

Test coverage: 100.0%

@floehopper floehopper force-pushed the fix-student-account-predicate-return-value branch from 42a77bf to 03377c2 Compare August 18, 2025 10:10
Previously this method returned either `0` or `nil`. This works fine in
Ruby, because `0` is truth-y, but it causes problems if you want to
persist the value in a Postgres boolean type, because `0` is cast to
`FALSE`. The new implementation always returns either `true` or `false`.

This will mean we can remove this workaround [1] in experience-cs.

[1]: RaspberryPiFoundation/experience-cs@130592b
@floehopper floehopper force-pushed the fix-student-account-predicate-return-value branch from 03377c2 to 55fea6b Compare August 18, 2025 10:22
@floehopper floehopper merged commit 22910d6 into main Aug 18, 2025
13 checks passed
@floehopper floehopper deleted the fix-student-account-predicate-return-value branch August 18, 2025 10:34
floehopper added a commit that referenced this pull request Aug 18, 2025
### Added

- Add optional `on_login_success` callback (#90)

### Fixed

- Return boolean from `AccountTypes#student_account?` (#91)
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.

2 participants