I have an Active Model Serializer defined for my model and everything works fine when I call render json passing a single collection, like this:
render json: @collection
The problem is when I try to merge different attributes and collections, for example:
json_response = service.errors.merge(attribute1: value1)
render json: json_response.merge(collection1: @collection, collection2: @collection2)
When I do that, the collections does not use the defined Active Record Serializer. Instead, they just serialize all their attributes.
How can I ensure that when I do these merges, the serialization still uses the Active Record Serializer that I have defined for them?
serviceis it a database entry? - Tobias