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
Replace hasMany relationships fails #3833
Comments
Can you give a little bit more information? What version are you using? What does the model definition for |
Relationships are more complex object then an array so its not possible to set the relationship property directly. Instead can use the setObjects method on the relationship. |
My bad @IsaiahJTurner. @pangratz reminded me that there is special code to handle the case of setting an array: data/packages/ember-data/lib/system/relationships/has-many.js Lines 146 to 152 in fcf5452
What is the error that you are seeing? |
I made a JSBin: http://emberjs.jsbin.com/xemunezoki/edit?html,js,console,output |
OK, so the problem is that One way to do this is via update: function() {
var newBooks = [
this.store.find("book", 4)
];
var model = this.get('model');
Ember.RSVP.all(newBooks).then(function(newBooks) {
model.get('books').setObjects(newBooks);
// or you can use model.set('books', newBooks);
});
} The thrown error message @IsaiahJTurner do you want to submit a PR? |
I guess this issue can be closed since an assertion for only passing instances of |
Doing something like:
ama.set("questions", [Question, Question, Question]);
does not work.
The text was updated successfully, but these errors were encountered: