Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed embedded belongsTo relationships #1067

Closed
wants to merge 1 commit into from
Closed

Fixed embedded belongsTo relationships #1067

wants to merge 1 commit into from

Conversation

marcoow
Copy link

@marcoow marcoow commented Jul 3, 2013

This fixes an an error where the code

Person = DS.Model.extend({
  name: DS.attr('string')
});
Group = DS.Model.extend({
  name: DS.attr('string'),
  people: DS.hasMany(Person)
});
Person.reopen({
  group: DS.belongsTo(Group)
});
Adapter.map(Person, {
  group: { embedded: 'always' }
});

store.createRecord(Person, { name: "Tom Dale", group: store.createRecord(Group, { name: "Ember.js Group" }) });
store.commit();

would trigger 2 POST requests (1 to /people, 1 to /groups) where you would only expect 1 (because of group being embedded in person).

@wagenet
Copy link
Member

wagenet commented Aug 14, 2013

@marcoow Can you squash these commits and rebase on master? Thanks!

@marcoow
Copy link
Author

marcoow commented Aug 14, 2013

@wagenet: done

@wycats
Copy link
Member

wycats commented Sep 5, 2013

Embedded relationships aren't back in Ember Data 1.0 Beta yet. When it comes back, I'll make sure to consider this case.

@wycats wycats closed this Sep 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants