Class: ReviewableScoreTypeSerializer

Inherits:
ApplicationSerializer show all
Defined in:
app/serializers/reviewable_score_type_serializer.rb

Instance Method Summary collapse

Methods inherited from ApplicationSerializer

expire_cache_fragment!, fragment_cache

Methods inherited from ActiveModel::Serializer

#include!

Instance Method Details

#iconObject



24
25
26
# File 'app/serializers/reviewable_score_type_serializer.rb', line 24

def icon
  "flag"
end

#include_reviewable_priority?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/serializers/reviewable_score_type_serializer.rb', line 20

def include_reviewable_priority?
  object.respond_to?(:reviewable_priority)
end

#reviewable_priorityObject



16
17
18
# File 'app/serializers/reviewable_score_type_serializer.rb', line 16

def reviewable_priority
  object.reviewable_priority.to_i
end

#titleObject

Allow us to share post action type translations for backwards compatibility



11
12
13
14
# File 'app/serializers/reviewable_score_type_serializer.rb', line 11

def title
  I18n.t("post_action_types.#{ReviewableScore.types[id]}.title", default: nil) ||
    I18n.t("reviewable_score_types.#{ReviewableScore.types[id]}.title")
end

#typeObject



6
7
8
# File 'app/serializers/reviewable_score_type_serializer.rb', line 6

def type
  ReviewableScore.types[id]
end