class PollAnswer < ApplicationRecord # default_scope :order => 'answer_position' # include Redmine::SafeAttributes belongs_to :poll_question has_many :poll_votes, :dependent => :destroy scope :find_answer_by_custom, lambda {|k,v| where("#{k}":v)} #根据传入的参数查找问题 scope :left_answer_choose, lambda {|k,v| where("#{k} > ?",v)} #根据传入的参数查找问题 end