Sha256: 44f18f7b06c938955baddedb2f7bc89ff69323d4656681360d1e085688d742e3

Contents?: true

Size: 1.14 KB

Versions: 7

Compression:

Stored size: 1.14 KB

Contents

# #
# AUTO GENERATED MODEL
# This model was auto generated by the CanvasSync Gem.
# You can customize it as needed, but make sure you test
# any changes you make to the auto generated methods.
#


class Course < ApplicationRecord
  include CanvasSync::ApiSyncable

  validates :canvas_id, uniqueness: true, presence: true
  belongs_to :term, foreign_key: :canvas_term_id, primary_key: :canvas_id, optional: true
  has_many :enrollments, primary_key: :canvas_id, foreign_key: :canvas_course_id
  has_many :sections, primary_key: :canvas_id, foreign_key: :canvas_course_id
  has_many :assignments, as: :context, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
  has_many :submissions, primary_key: :canvas_id, foreign_key: :canvas_course_id
  has_many :assignment_groups, primary_key: :canvas_id, foreign_key: :canvas_course_id
  
  api_syncable({
    sis_id: :sis_course_id,
    course_code: :course_code,
    name: :name,
    workflow_state: :workflow_state,
    canvas_term_id: :enrollment_term_id,
    canvas_account_id: :account_id,
    start_at: :start_at,
    end_at: :end_at,
  }, -> (api) { api.course(canvas_id) })
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
canvas_sync-0.11.1 spec/dummy/app/models/course.rb
canvas_sync-0.12.0 spec/dummy/app/models/course.rb
canvas_sync-0.11.0 spec/dummy/app/models/course.rb
canvas_sync-0.10.6 spec/dummy/app/models/course.rb
canvas_sync-0.10.5 spec/dummy/app/models/course.rb
canvas_sync-0.10.4 spec/dummy/app/models/course.rb
canvas_sync-0.10.3 spec/dummy/app/models/course.rb