Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
EmberJS belongsTo
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
You can’t perform that action at this time.