You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/models/poll_answer.rb

11 lines
412 B

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