In the donation model, manual is a boolean and should not accept null values.
Description
The manual field in the donation model is defined as a boolean type, which should only accept true or false values. However, the field is currently accepting null values, which violates the expected boolean constraint and can lead to unexpected behavior in queries and business logic that rely on this field having a definite true/false state.
Expected Behavior
- The
manual field should only accept boolean values: true or false
- Attempting to insert or update a donation record with a
null value for manual should either:
- Raise a validation error, or
- Default to a specified boolean value (e.g.,
false)
- Database schema should enforce NOT NULL constraint on this column
Actual Behavior
- The
manual field accepts null values without raising an error
- Records can be created or updated with
manual = null
- Queries checking for
manual = true or manual = false may miss records where manual is null
Possible Fix
Add a NOT NULL constraint to the database column:
change_column_null :donations, :manual, false, false
Steps to Reproduce
Context
Your Environment
- Ruby version:
- Server type and version:
- Operating System and version:
- Link to your project:
In the donation model,
manualis a boolean and should not accept null values.Description
The
manualfield in the donation model is defined as a boolean type, which should only accepttrueorfalsevalues. However, the field is currently acceptingnullvalues, which violates the expected boolean constraint and can lead to unexpected behavior in queries and business logic that rely on this field having a definite true/false state.Expected Behavior
manualfield should only accept boolean values:trueorfalsenullvalue formanualshould either:false)Actual Behavior
manualfield acceptsnullvalues without raising an errormanual = nullmanual = trueormanual = falsemay miss records wheremanualisnullPossible Fix
Add a NOT NULL constraint to the database column:
Steps to Reproduce
Context
Your Environment