I am trying to retrieve a specific attribute from a one to many relationship using "with".
gets me the booking with an array of booking lines. All good.
gets me the booking with an empty array where the booking lines should be. Even just including the
id attribute doesn't work, and neither does using
I have successfully used this style of
with clause in many to many relationships. What am I missing here?
Never mind, found the solution. In a one to many relationship you have to include the foreign key in the with clause. I saw no mention of this in the documentation.
Here is what worked:
Hope this helps someone else.
Sign in to participate in this thread!