class ProjectGroupSerializer < ActiveModel::Serializer attributes :id, :name, :description, :projects def projects object.projects.map do |project| ::ProjectSerializer.new(project).attributes end end end