ActiveModel::Serializer ignored

Defining ActiveModel::Serializer are not automatically recognized by controllers.

Specifying serializer like below does nothing

  render json: clients, each_serializer: ClientSerializer

Calling explicitly like below works,

  render json:

Wondering if the directory isn’t preloaded since the location is app/serializers


Naw, don’t believe preloading is it since it works when you call it explicitly. Will have to dig into render to use the each_serializer option. Happy to consider PRs :+1:

Thanks for your reply.

There is also an option for :show method where you can serialize a single resource by calling
render json: client, serializer: ClientSerializer
This isn’t working either. So I think it is related and not limited to each_serializer option.

Although as we are able to call it explicitly and it is working, anyone trying and arriving here should be able to continue.

Hi, guys! Any progress on this? Is @ratneshraval’s method still the recommended way to solve the problem?