I'm messing around with the v0.10 release of sails, and I have come across a puzzling issue. I have a relationship with the app I'm building which is a simple quiz app. The issue arises around the structure of my models and associations:
Quiz -> Questions -> Answers
Quiz:
attributes: {
questions: {
collection: 'Question',
via: 'quiz'
}
}
Question:
attributes: {
answers: {
collection: 'Answer',
via: 'question'
},
quiz: { model: 'Quiz' }
}
Answer:
attributes: {
question: { model: 'Question' }
}
I've left out the rest of the model code for clarity.
Now the problems, when I retrieve the resource at api/quiz the questions are populated but there are no answers. I read somewhere that there is no nested model population in sails/waterline yet, is this really the case?
Even if I go to api/question then I get back the questions but without answers, in this case I wouldn't regard the answer as being nested. It seems that no matter what I do I cannot get sails to populate answers into questions, but it will always populate questions in quiz.
Ok so it seems that I was using sails 0.10.0 rc-7 once I upgraded to 0.10.5 the problems ceased