2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2017-09-05 22:23:34 +03:00
|
|
|
class Vote < ApplicationRecord
|
2014-06-23 19:07:50 +03:00
|
|
|
belongs_to :user
|
2023-03-01 11:33:21 -08:00
|
|
|
belongs_to :event, touch: true
|
2016-05-24 23:54:46 +05:30
|
|
|
|
2020-05-19 22:24:37 -04:00
|
|
|
validates :user_id, uniqueness: { scope: :event_id }
|
|
|
|
|
|
2016-05-24 23:54:46 +05:30
|
|
|
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
|
|
|
|
|
|
2014-06-24 12:14:53 +03:00
|
|
|
delegate :name, to: :user
|
2016-05-24 23:54:46 +05:30
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def conference_id
|
|
|
|
|
event.program.conference_id
|
|
|
|
|
end
|
2014-06-23 19:07:50 +03:00
|
|
|
end
|