discourse/app/serializers/embeddable_host_serializer.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
365 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class EmbeddableHostSerializer < ApplicationSerializer
TO_SERIALIZE = %i[id host allowed_paths class_name category_id tags user]
attributes *TO_SERIALIZE
2019-05-07 09:27:05 +08:00
TO_SERIALIZE.each { |attr| define_method(attr) { object.public_send(attr) } }
def user
object.user&.username
end
def tags
object.tags.map(&:name)
end
end