I had the same error and found changing serializer:
to each_serializer:
in the controller solved the issue.
Controller
class RecordsController < ApplicationController
...
def artist
@records = Record.where('artist_id = ' + params[:artist_id])
render :json => @records, each_serializer: RecordSummarySerializer
end
...
end
record_summary_serializer.rb – can remove the include line
class RecordSummarySerializer < ActiveModel::Serializer
attributes :id, :artist_id, :label_id, :style_id, :title, :catalog,
:recording_date, :penguin, :category
end
From active_model_serializers documentation.
Updated link. thanks Lowryder