|
|
|
@ -4,13 +4,13 @@ class Poll < ApplicationRecord
|
|
|
|
|
belongs_to :exercise_bank, optional: true
|
|
|
|
|
|
|
|
|
|
# belongs_to :exercise_bank
|
|
|
|
|
has_many :poll_questions,dependent: :destroy
|
|
|
|
|
has_many :poll_users, :dependent => :destroy
|
|
|
|
|
has_many :poll_questions,dependent: :delete_all
|
|
|
|
|
has_many :poll_users, :dependent => :delete_all
|
|
|
|
|
has_many :users, :through => :poll_users #该文件被哪些用户提交答案过
|
|
|
|
|
has_many :poll_group_settings, :dependent => :destroy
|
|
|
|
|
has_many :course_acts, class_name: 'CourseActivity', as: :course_act, dependent: :destroy
|
|
|
|
|
has_many :poll_group_settings, :dependent => :delete_all
|
|
|
|
|
has_many :course_acts, class_name: 'CourseActivity', as: :course_act, dependent: :delete_all
|
|
|
|
|
|
|
|
|
|
has_many :tidings, as: :container, dependent: :destroy
|
|
|
|
|
has_many :tidings, as: :container, dependent: :delete_all
|
|
|
|
|
|
|
|
|
|
scope :publish_or_not, -> { where("polls_status > ? ",1)}
|
|
|
|
|
scope :only_public, -> {where("is_public = ?",true)}
|
|
|
|
|