Created
June 10, 2014 17:12
-
-
Save mupkoo/e2ea9b3a604126d0f00e to your computer and use it in GitHub Desktop.
EmberJS belongsTo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.User = DS.Model.extend({ | |
name: DS.belongsTo('name', { embedded: true }), | |
email: DS.attr('string') | |
}); | |
App.Name = DS.Model.extend({ | |
first: DS.attr('string'), | |
last: DS.attr('string') | |
}); | |
App.UserEditController = Ember.ObjectController.extend({ | |
actions: { | |
save: function () { | |
var name = this.store.createRecord('name', { first: 'Mirko', last: 'Akov' }); | |
this.set('name', name); | |
this.get('model').save(); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment