I have two models: "Author" and "Publisher" (Rails), with the publisher hasOne, the author / author belongs to the publisher.
I have the correct settings for Ember models - JS Fiddle - and associations that work when manually clicked in the repository. But on request / publishers, only publisher records are created.
I tried several types of JSON responses:
Author Publishers
{
"publishers": [
{
"id": 1,
"name": "Test P 1",
"author": 1
}
],
"author": {
"id": 1,
"name": "Test A 1",
"publisher": 1
}
}
Publishers with Authors
{
"publishers": [
{
"id": 1,
"name": "Test P 1",
"author": 1
}
],
"authors": [{
"id": 1,
"name": "Test A 1",
"publisher": 1
}]
}
Publisher with embedded author
{
"publishers": [
{
"id": 1,
"name": "Test P 1",
"author": {
"id": 1
"name": "Test A 1"
}
}
]
}
Thanks for any help!
source
share