JSON output with relations

30 views
Skip to first unread message

Halil Ibrahim YILMAZ

unread,
Apr 2, 2015, 3:12:58 AM4/2/15
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.
Reply all
Reply to author
Forward
0 new messages