class PollVote < ApplicationRecord
  # attr_accessible :poll_answers_id, :poll_questions_id, :user_id, :vote_text
  # include Redmine::SafeAttributes

  belongs_to :poll_answer, optional: true
  belongs_to :poll_question
  belongs_to :user

  scope :find_current_vote,lambda {|k,v| where("#{k}": v)}
  scope :find_vote_text,-> {where("vote_text IS NOT NULL")}

  validates :vote_text, length: { maximum: 5000, too_long: "不能超过5000个字符" }

end