Found it on https://github.com/datamapper/dm-serializer in lib/to_json.rb
There are two options it seems, relationships
and methods
as options to the to_json
method. Default inclusions are not yet possible, but requested:
@article.to_json(methods: [ :comments ])
To go deeper, there is an undocumented (so subject to change) example in a comment in the code is:
comments.to_json(:relationships=>{:user=>{:include=>[:first_name],:methods=>[:age]}})
So something like:
@article.to_json(relationships: { comments: { methods: [ :likes ] } }