Skip to content

Commit

Permalink
[DOC] Cleanup example code in attr
Browse files Browse the repository at this point in the history
  • Loading branch information
knownasilya authored Feb 10, 2017
1 parent ff4e5c6 commit 6bef088
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions addon/attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ function getValue(record, key) {
export default DS.Model.extend({
username: attr('string'),
email: attr('string'),
settings: attr({defaultValue: function() {
return {};
}})
settings: attr({
defaultValue() {
return {};
}
})
});
```
Expand All @@ -83,6 +85,8 @@ function getValue(record, key) {
transformation and adapt the corresponding value, based on the config:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
text: DS.attr('text', {
uppercase: true
Expand All @@ -91,6 +95,8 @@ function getValue(record, key) {
```
```app/transforms/text.js
import DS from 'ember-data';
export default DS.Transform.extend({
serialize(value, options) {
if (options.uppercase) {
Expand Down

0 comments on commit 6bef088

Please sign in to comment.