class Vote < ApplicationRecord belongs_to :votable, polymorphic: true validates :upvote, presence: true, inclusion: { in: [0, 1] } end