json - Rabl model extends -


i creating json outputs of rails models.

i have 2 models: piece , set. relationships are:

a pieces belongs set

and

a set has many pieces

now, have started write rabl json templates both models , each outputs relationship items, eg: set outputs it's pieces , pieces outputs set belongs to.

i ahve done separately due issue wondered best way of resolving issue convert template set allows pieces in use template piece, however, piece template outputs it's set use template set , keep looping , fall over.

is there way around this?

since writing question have gone ahead , built out , yes, issue has occurred. result json file 500 internal server error.

is there way can conditionally add child pieces if set show json being rendered leave them out if index json rendered?

solved using local variables.

i passed local variable extend determine whether display inner content or not.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -