mardi 10 juin 2014

Using session:true on store breaks associations

The posts are missing the foreign key that relates it to the user. So they don't appear in the store because they aren't valid items.

Code:



{
"success": true,
"user": [{
"id": 1,
"name": "Philip J. Fry",
"posts": [{
"title": "Post 1",
"userId": 1
},{
"title": "Post 2",
"userId": 1
},{
"title": "Post 3",
"userId": 1
}]
},{
"id": 2,
"name": "Turanga Leela",
"posts": [{
"title": "Post 4",
"userId": 2
},{
"title": "Post 5",
"userId": 2
},{
"title": "Post 6",
"userId": 2
}]
},{
"id": 3,
"name": "Mad Scientist",
"posts": [{
"title": "Post 7",
"userId": 3
},{
"title": "Post 8",
"userId": 3
},{
"title": "Post 9",
"userId": 3
}]
}]
}

Moving to Q&A.


Aucun commentaire:

Enregistrer un commentaire