osem-fcy/app/models/vote.rb

17 lines
309 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Vote < ApplicationRecord
2014-06-23 19:07:50 +03:00
belongs_to :user
2019-08-09 17:33:42 +05:30
belongs_to :votable, polymorphic: true
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
2019-08-09 17:33:42 +05:30
votable.program.conference_id
end
2014-06-23 19:07:50 +03:00
end