Hey hey all, I put together a quick JSBin to elaborate on the questions I have here: http://jsbin.com/isopaHey/10/edit
The idea is a very simple one to many setup – product has many reviews. Reviews are being sorted in a controller, and there’s an action on the ProductController to create new reviews. It’s using Ember Data Fixtures.
There’s a few questions I’m still trying to find the best answer for that are in the JSBin, but i’ll repeat them here too:
-
There’s a property in the controller for the current review text that’s cleared out after save. It shouldn’t happen until the
then
callback though, which doesn’t have access to the controller. Any suggestions on a possible way of handling this? -
After
save
in thethen
callback, I’m needing to do something likeproduct.get('reviews').addObject(review);
in order to have the interface update accordingly. From how I understand it, just callingstore.createRecord
has added it to the store, andsave
has updated it with anid
and all that. Not sure if/why I need to do this here. Shouldn’t it already be added? Or is there another way it should be created? -
Is there a way to simulate failure with the FixtureAdapter?
-
Unrelated question to Ember Data, but curious about it as well: Sorting for comments isn’t working correctly with newly added comments. It sorts correctly on page load, but the added reviews aren’t sorted correctly.
Also, if anyone has any other comments/suggestions on how they’d structure this code, I’m all ears.