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/homework_bank.rb

14 lines
470 B

6 years ago
class HomeworkBank < ApplicationRecord
# homework_type: 1普通作业 2编程作业弃用 3分组作业 4实训作业
belongs_to :course_list
belongs_to :homework_common, optional: true
belongs_to :user
has_many :attachments, as: :container, :dependent => :destroy
has_many :homework_commons, dependent: :nullify
scope :is_public, -> { where(is_public: true)}
scope :myself, ->(user_id) { where(user_id: user_id)}
end