Skip to content

Commit

Permalink
Document the allowNull property on the boolean transform
Browse files Browse the repository at this point in the history
  • Loading branch information
bmac committed Aug 26, 2016
1 parent 79c81a5 commit ed794d9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions addon/-private/transforms/boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ const { isNone } = Ember;
});
```
By default the boolean transform only allows for values of `true` or
`false`. You can opt into allowing `null` values for
boolean attributes via `DS.attr('boolean', { allowNull: true })`
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
email: DS.attr('string'),
username: DS.attr('string'),
wantsWeeklyEmail: DS.attr('boolean', { allowNull: true })
});
```
@class BooleanTransform
@extends DS.Transform
@namespace DS
Expand Down

0 comments on commit ed794d9

Please sign in to comment.