Halil Ibrahim YILMAZ
unread,Apr 2, 2015, 3:12:58 AM4/2/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to chica...@googlegroups.com
Hi guys,
Is there any way to serve database collections with relations via json?
My function looks like the following :
findings('GET', []) ->
Periods=boss_db:find(period,[{deleted,'equals', 0}], [{},{},{order_by,'created_at'}, descending]),
Areas=boss_db:find(area,[{deleted,'equals', 0}], [{},{},{order_by,'created_at'}, descending]),
{json, [{areas, Areas},{periods, Periods}]}.
This works fine, however Area model "has many" "Media" records which are not inside the JSON output.
I need the relational data inside JSON output.
Cheers,
Ibrahim.