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

13 lines
382 B

class GtaskBank < ApplicationRecord
belongs_to :user
belongs_to :graduation_task, optional: true
belongs_to :course_list, optional: true
has_many :attachments, as: :container, dependent: :destroy
has_many :graduation_tasks, dependent: :nullify
scope :myself, ->(user_id) { where(user_id: user_id)}
scope :is_public, -> { where(:is_public => true) }
end