Sha256: 93ee78f36d9552a6fd88ef3ebea505bf8042a852d1cca876e15d856d7b644d49

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

Contents

module CoalescingPanda
  class Course < ActiveRecord::Base
    belongs_to :account, foreign_key: :coalescing_panda_lti_account_id, class_name: 'CoalescingPanda::LtiAccount'
    belongs_to :term, foreign_key: :coalescing_panda_term_id, class_name: 'CoalescingPanda::Term'
    has_many :sections, foreign_key: :coalescing_panda_course_id, class_name: 'CoalescingPanda::Section', dependent: :destroy
    has_many :enrollments, through: :sections, dependent: :destroy
    has_many :assignments, foreign_key: :coalescing_panda_course_id, class_name: 'CoalescingPanda::Assignment', dependent: :destroy
    has_many :submissions, through: :assignments, dependent: :destroy
    has_many :users, through: :sections, source: :users, class_name: 'CoalescingPanda::User'
    has_many :groups, :as => :context, class_name: 'CoalescingPanda::Group', dependent: :destroy
    has_many :group_memberships, through: :groups, source: :group_memberships, class_name: 'CoalescingPanda::GroupMembership', dependent: :destroy
    has_many :canvas_batches, as: :context, dependent: :destroy

    validates :coalescing_panda_lti_account_id, presence: true
    validates :canvas_course_id, presence: true
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
coalescing_panda-4.1.0 app/models/coalescing_panda/course.rb
coalescing_panda-4.0.4 app/models/coalescing_panda/course.rb
coalescing_panda-4.0.3 app/models/coalescing_panda/course.rb
coalescing_panda-4.0.2 app/models/coalescing_panda/course.rb
coalescing_panda-4.0.1 app/models/coalescing_panda/course.rb
coalescing_panda-4.0.0 app/models/coalescing_panda/course.rb