osem-fcy/app/models/vote.rb

19 lines
355 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Vote < ApplicationRecord
2014-06-23 19:07:50 +03:00
belongs_to :user
belongs_to :event, touch: true
validates :user_id, uniqueness: { scope: :event_id }
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
2014-06-24 12:14:53 +03:00
delegate :name, to: :user
private
def conference_id
event.program.conference_id
end
2014-06-23 19:07:50 +03:00
end