When I define an attribute for a model in ember-data, can I specify a default value?
The ember-data model definition suggests attributes are defined like this:
attributeName: DS.attr('number')
...with an optional second argument as an options hash. I've looked at the code but my code-reading skills aren't up to figuring out what attributes I can put in the options hash. Is it possible to do something like this?
attributeName: DS.attr('number', { default: 0 })
or
attributeName: DS.attr('boolean', { default: false })
?
You were close, it's defaultValue
, see attributes.js#L63-65.