Open belluzj opened 11 years ago
Can you give an example where you hit this for context?
https://github.com/belluzj/epf_example/commit/94f0429caa4c5468e0e189db421fb90f7d384533
If you are to clone this and launch it (on the lazy-broken
branch), please also consider switching to master
and try to add a new contact, with an emergency number, and, you will encounter the problem described in my other issue #61
Thanks in advance
Thanks for this pull request, fixed a problem I was having when manually creating models from JSON with belongsTo relationships and merging them with session.merge(model)
. The session not existing on the belongsTo was throwing errors but this indeed fixes it.
I am going to put some more work into lazy models soon, but in the mean time I will merge this if I could get a failing test.
I'm sorry, I'm not working on Ember-based applications anymore, I won't be able to write tests. But you already have a whole failing application at https://github.com/belluzj/epf_example/tree/broken-lazy. (it was broken at the time, I'm not sure it still is).
This fix removed lots of errors from my console, and stabilized my app.
It seems that while EPF loads json with sideloaded models, at some point models don't have a session yet but are triggered to load because of observers. Without this fix it just breaks and the lazy model is never resolved. With it, the loading eventually takes place.