mastodon/app/serializers/rest/rule_serializer.rb
2025-04-18 15:40:04 +02:00

16 lines
330 B
Ruby

# frozen_string_literal: true
class REST::RuleSerializer < ActiveModel::Serializer
attributes :id, :text, :hint, :translations
def id
object.id.to_s
end
def translations
object.translations.to_h do |translation|
[translation.language, { text: translation.text, hint: translation.hint }]
end
end
end