From 6bef088b940942c9460e79b4dd51a8e75214723b Mon Sep 17 00:00:00 2001 From: Ilya Radchenko Date: Fri, 10 Feb 2017 11:13:04 -0500 Subject: [PATCH] [DOC] Cleanup example code in attr --- addon/attr.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/addon/attr.js b/addon/attr.js index 9380d1e370e..9b5a094f422 100644 --- a/addon/attr.js +++ b/addon/attr.js @@ -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 {}; + } + }) }); ``` @@ -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 @@ -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) {