I use ActiveModel::Serializer.config.adapter = :json as adapter, but the root: false option is not working.
render json: alliances,
each_serializer: AllianceSerializer::Common,
root: false
it will generate json as follow.
{ alliance: { id: 123 } }
In master, the way to remove the root of the JSON document is by using the Attributes adapter. Just pass the adapter: :attributes to your render call.
ok, thx
Most helpful comment
In master, the way to remove the root of the JSON document is by using the
Attributesadapter. Just pass theadapter: :attributesto your render call.