Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upbelongsTo association id not serialized in ember-data-1.0.0-beta.15 #2823
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
leporid
Feb 28, 2015
+1
I just spent a fair bit of time discovering the same problem. Showstopper. I will back off beta.15 in the meantime...
-------------------------------
Ember : 1.9.0
Ember Data : 1.0.0-beta.15
Handlebars : 2.0.0
jQuery : 1.11.2
-------------------------------
leporid
commented
Feb 28, 2015
|
+1 I just spent a fair bit of time discovering the same problem. Showstopper. I will back off beta.15 in the meantime...
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
wecc
Feb 28, 2015
Contributor
Are you using custom adapters/serializers that calls serialize() with a record instead of a snapshot? (as was the case of #2801) If not, there shouldn't be code paths in ED that ends up with a record instead of snapshot in serialize(), a failing JSBin would be awesome for troubleshooting.
|
Are you using custom adapters/serializers that calls |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
pierrevdb
Mar 1, 2015
Hi @wecc
We're not using any custom adapters or serializers - just the stock ActiveModelAdapter.
With regards to #2801, I just meant that this is likely also related to the move to snapshots. This assumption is, admittedly, not based on any digging in the code as I haven't really had the time to do so.
Cheers
Pierre
pierrevdb
commented
Mar 1, 2015
|
Hi @wecc We're not using any custom adapters or serializers - just the stock ActiveModelAdapter. With regards to #2801, I just meant that this is likely also related to the move to snapshots. This assumption is, admittedly, not based on any digging in the code as I haven't really had the time to do so. Cheers |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
@pierrevdb would you be able to replicate the issue in a JSBin? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bmac
Mar 6, 2015
Member
Ping @pierrevdb any chance you could replicate this in a JSBin? Here is an example bin to get you started: http://emberjs.jsbin.com/qovara/2/edit?html,js,output
|
Ping @pierrevdb any chance you could replicate this in a JSBin? Here is an example bin to get you started: http://emberjs.jsbin.com/qovara/2/edit?html,js,output |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
pierrevdb
Mar 7, 2015
Sorry for the delayed response - been a little busy.
I'll try to make some time this week.
pierrevdb
commented
Mar 7, 2015
|
Sorry for the delayed response - been a little busy. I'll try to make some time this week. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jordpo
Mar 13, 2015
I'm also running into this issue. It's working fine in beta v14.1. does anyone have any suggestions for a workaround? thanks!
jordpo
commented
Mar 13, 2015
|
I'm also running into this issue. It's working fine in beta v14.1. does anyone have any suggestions for a workaround? thanks! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
wecc
Mar 14, 2015
Contributor
@jordpo If you'd be able to reproduce the issue in a JSBin it would be great. Makes it so much easier to troubleshoot.
If you're using custom adapters and/or serializers that manually calls serialize methods you need to make sure that the serialize methods receives a snapshot instead of a model. This will be improved upon shortly as we're making sure adapters are receiving snapshots instead of models in the first place. But that is currently not the case.
If you're only using default adapters/serializers there's probably a bug somewhere that needs to be fixed. A failing JSBin would be awesome so we can identify the bug.
|
@jordpo If you'd be able to reproduce the issue in a JSBin it would be great. Makes it so much easier to troubleshoot. If you're using custom adapters and/or serializers that manually calls serialize methods you need to make sure that the serialize methods receives a snapshot instead of a model. This will be improved upon shortly as we're making sure adapters are receiving snapshots instead of models in the first place. But that is currently not the case. If you're only using default adapters/serializers there's probably a bug somewhere that needs to be fixed. A failing JSBin would be awesome so we can identify the bug. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jordpo
Mar 15, 2015
@wecc - here you go:
http://emberjs.jsbin.com/kivetopeqa/1/edit?html,js,output
I believe this replicates the issue that I am experiencing. Specifically in my case, I am using a select view to dynamically set a belongsTo relationship. While playing around with the JSBin, I noticed that the belongsTo relationship somehow disappears when I call save on the model.
I, too, am using the ActiveModelSerializer adapter and can confirm that the organizationId is not serialized and sent to the server at all.
Let me know if you need anything else.
jordpo
commented
Mar 15, 2015
|
@wecc - here you go: http://emberjs.jsbin.com/kivetopeqa/1/edit?html,js,output I believe this replicates the issue that I am experiencing. Specifically in my case, I am using a select view to dynamically set a belongsTo relationship. While playing around with the JSBin, I noticed that the belongsTo relationship somehow disappears when I call save on the model. I, too, am using the ActiveModelSerializer adapter and can confirm that the organizationId is not serialized and sent to the server at all. Let me know if you need anything else. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jordpo
Mar 15, 2015
Yeah looking at it closer, the JSBin is just resetting the model to its original fixture state. So not quite the exact replication of the issue that I am facing..
jordpo
commented
Mar 15, 2015
|
Yeah looking at it closer, the JSBin is just resetting the model to its original fixture state. So not quite the exact replication of the issue that I am facing.. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jordpo
Mar 15, 2015
Here is an updated JSBin using the ActiveModelAdapter. Can't seem to replicate the issue. Will look at it closer tomorrow when I get my local development running again.
jordpo
commented
Mar 15, 2015
|
Here is an updated JSBin using the ActiveModelAdapter. Can't seem to replicate the issue. Will look at it closer tomorrow when I get my local development running again. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
wecc
Mar 15, 2015
Contributor
@jordpo Thanks!
I think this is the select tripping you up. Replacing value=model.organization.content with selection=model.organization actually gives you the right value when saving (if you give your organization IDs - do push instead of createRecord). The select is known to have some weirdness and it's being rewritten. Would it be possible to try to replicate this issue without using the select?
|
@jordpo Thanks! I think this is the select tripping you up. Replacing |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jordpo
Mar 16, 2015
@wecc - thank you! Yeah it does indeed appear our issue stems from the select. Using selection=model.organization does fix the issue of setting the organizationId on the serializer. However it is not showing the current value in the select now, without specifically indicating 'content' in the selection (selection=model.organization.content). Here is the my entire select view.
{{view 'select'
prompt='--Select organization--'
selection=model.organization
content=organizations
optionLabelPath='content.name' optionValuePath='content'}}
No worries if this no longer belongs in this thread. I'll do some more digging on my end. But it doesn't appear to be an adapter issue as initially thought.
jordpo
commented
Mar 16, 2015
|
@wecc - thank you! Yeah it does indeed appear our issue stems from the select. Using
No worries if this no longer belongs in this thread. I'll do some more digging on my end. But it doesn't appear to be an adapter issue as initially thought. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
wecc
Mar 18, 2015
Contributor
@jordpo
@pierrevdb Is your issue related to the one described above or might it be something else?
|
@jordpo @pierrevdb Is your issue related to the one described above or might it be something else? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
pierrevdb
Mar 19, 2015
My issue looks very similar: the content of a select view set to the result of a promise (store#find) which required selection to be set to xxx.content. If the selection is set to xxx it doesn't change xxx when you select a different option from the drop-down. I'm using ObjectController so I'm not referencing the model directly (xxx instead of model.xxx).
I checked the model in the Ember explorer as well as manually in the debugger, and the value of xxx was set correctly prior to serialization but was not serialized.
I've subsequently changed the way select views are populated for other reasons, but haven't had a chance to try beta15 again. I'll give it a try and let you know when I find a gap somewhere.
pierrevdb
commented
Mar 19, 2015
|
My issue looks very similar: the content of a select view set to the result of a promise (store#find) which required selection to be set to xxx.content. If the selection is set to xxx it doesn't change xxx when you select a different option from the drop-down. I'm using ObjectController so I'm not referencing the model directly (xxx instead of model.xxx). I checked the model in the Ember explorer as well as manually in the debugger, and the value of xxx was set correctly prior to serialization but was not serialized. I've subsequently changed the way select views are populated for other reasons, but haven't had a chance to try beta15 again. I'll give it a try and let you know when I find a gap somewhere. |
jackmatt2
referenced this issue
May 13, 2015
Closed
Updating from 1.0.0-beta.14 to anything =>1.0.0-beta.15 broke my belongsTo relationship #3063
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
wecc
Jun 2, 2015
Contributor
@pierrevdb did you get a chance to try out a more recent beta? could this be closed?
|
@pierrevdb did you get a chance to try out a more recent beta? could this be closed? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
pierrevdb
Jun 3, 2015
@wecc I think you should close this for now.
I haven't had a chance to try a new beta but am planning on trying the latest in the next week or so but, since I changed the way I use select view,s the issue wouldn't be immediately obvious after an upgrade so I would need to spend some time to test again. If I find a problem I can always open a new issue for the latest beta.
Thanks for following up.
pierrevdb
commented
Jun 3, 2015
|
@wecc I think you should close this for now. I haven't had a chance to try a new beta but am planning on trying the latest in the next week or so but, since I changed the way I use select view,s the issue wouldn't be immediately obvious after an upgrade so I would need to spend some time to test again. If I find a problem I can always open a new issue for the latest beta. Thanks for following up. |
pierrevdb commentedFeb 26, 2015
Hey guys
I recently tried ember-data 1.0.0-beta.15 and the belongsTo association ids aren't serialized. Reverting to 1.0.0-beta.14.1 fixes the issue.
This stack works:
Ember : 1.10.0
Ember Data : 1.0.0-beta.14.1
This stack doesn't work:
Ember : 1.10.0
Ember Data : 1.0.0-beta.15
I think this is likely related to closed issue #2801 Snapshot not being injected on beta.15
Cheers
Pierre