-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
BooleanTransform should allow null values #3785
Comments
Hi @jaaksarv. I think you raise a very good point that // app/transforms/nullable-boolean.js
export default DS.BooleanTransform.extend({
deserialize: function(serialized) {
if (serialized === null) {
return null;
}
return this._super(serialized);
},
serialize: function(deserialized) {
if (deserialized === null) {
return null;
}
return this._super(deserialized);
}
}); // app/models/user.js
export default DS.Model.extend({
isAdmin: attr('boolean'),
isStaff: attr('nullable-boolean'),
email: attr('string')
}); |
Hi @jaaksarv. I'm going to close this issue because I don't think we can change the behavior of the Feel free to reopen or create a new pr if you would like to add a new Transform that supports null. |
@bmac Why closing? It should be fixed in 3.0 as you described above. |
Ok I will leave it open. |
We should add support for this feature when emberjs/rfcs#1 lands, assuming:
|
This should be solved by #4022 which will be enabled in the next beta. |
Currently BooleanTransform converts null values to false. This should not be default behavior. It is common to have nullable boolean values in database that represent situation where value is not yet defined. StringTransform, NumberTransform and DateTransform all support null values, so should BooleanTransform to make things consistent.
The text was updated successfully, but these errors were encountered: