Search code examples
ruby-on-railsactive-model-serializers

How to use multiple Serializers for the same model with ActiveModelSerializer rails 4


In my controller, i have two methods that render a json, i want to use differents serializer for each method. how can i do it. i've tried : render json: response ,each_serialiser: SerializerName in every methods by it's doesn't work


Solution

  • you should create two serializer for each response use one of them and rename the response.