feature/share-libs
rb 19 lines 345 Bytes
Raw
1 class SongProviderVote < ApplicationRecord
2 belongs_to :song_provider
3 belongs_to :user
4
5 enum vote_type: %i[up down]
6
7 def as_json(options = {})
8 options[:methods] = %i[id voter_gravatar voter_username_or_id]
9 super
10 end
11
12 def voter_gravatar
13 user.gravatar_url
14 end
15
16 def voter_username_or_id
17 user.username_or_id
18 end
19 end