-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
reload() and fetchById don't restore changed belongsTo #3089
Comments
The related test is |
@pangratz, thanks. And what about |
According to the doc Restoring local relationship changes via |
I mean is my expectation about |
Your confusion is justified as the naming of the methods is not consistent at the moment. There is an open RFC which discusses the semantics of the various methods to get a consistent naming. |
@pangratz, thanks for link. |
about as for me |
That method documentation is highly outdated and has been last updated at 22. April 2013 😮 Want to submit a PR? |
I'd like to, but it is not clearly for me what such a behavior for, so I do not know what description should be written. May be somebody can explain me... |
I would like to propose PR with changes:
For example:
Does it look reasonable? |
As an alternative just to implement new fetching method with "hard reset" merging strategy. Something like this: fetchOriginById: function(modelName, id, preload) {
if (this.hasRecordForId(modelName, id)) {
this.getById(modelName, id).unloadRecord();
}
return this.find(modelName, id, preload);
} UPD: this code fails with #3084 issue. |
closed since no confirmation |
It is known that if you change record's
belongsTo
property without saving, record doesn't becomedirty
and can't be restored byrollback()
emberjs/rfcs#21.But it was unexpected for me that it also can't be restored by
reload()
, and can't be reloaded bystore.fetchById()
. The only way works for me isrecord.unloadRecord()
and thenstore.find(..)
. See http://jsbin.com/qoyacagigi/edit?html,js,output.Feel free to close if this is expected behavior.
The text was updated successfully, but these errors were encountered: