Files
mastodon/app/serializers/rest/base_collection_serializer.rb
2025-12-08 11:40:17 +00:00

17 lines
446 B
Ruby

# frozen_string_literal: true
class REST::BaseCollectionSerializer < ActiveModel::Serializer
attributes :id, :uri, :name, :description, :local, :sensitive,
:discoverable, :item_count, :created_at, :updated_at
belongs_to :tag, serializer: REST::StatusSerializer::TagSerializer
def id
object.id.to_s
end
def item_count
object.respond_to?(:item_count) ? object.item_count : object.collection_items.count
end
end