Rails: Serializing deeply nested associations with active_model_serializers

Per commit 1426: https://github.com/rails-api/active_model_serializers/pull/1426 – and related discussion, you can see that the default nesting for json and attributes serialization is one level.

If you want deep nesting by default, you can set a configuration property in an active_model_serializer initializer:

ActiveModelSerializers.config.default_includes="**"

For detailed reference from v0.10.6: https://github.com/rails-api/active_model_serializers/blob/v0.10.6/docs/general/adapters.md#include-option

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)