0
Q:

how to display the has_many in the api serializer rails

class ProjectGroupSerializer < ActiveModel::Serializer
  attributes :id, :name, :description, :projects

  def projects
    object.projects.map do |project|
      ::ProjectSerializer.new(project).attributes
    end
  end
end
0

New to Communities?

Join the community