zhishi-engine/zhishi-backend

View on GitHub
app/serializers/notifications/question_serializer.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Notifications
  class QuestionSerializer < ActiveModel::Serializer
    attributes :id, :title, :content, :tags, :url, :type
    has_one :user

    private
      def url
        question_url(object)
      end

      def tags
        object.tags.pluck(:name)
      end

      def type
        'Question'
      end
  end
end