Sha256: fa551f23b340e782addb6642bf505fcff9936d20e7b879fa1b36bcc1a2ad64cf

Contents?: true

Size: 1.14 KB

Versions: 25

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 Section < ApplicationRecord
  include CanvasSync::Record
  include CanvasSync::Concerns::ApiSyncable

  canvas_sync_features :defaults

  # include CanvasSync::Concerns::LiveEventSync
  # after_process_live_event do
  #   # A section change could constitute a crosslisting change, which means
  #   # we need to make sure all our enrollments are pointing to the correct course
  #   enrollments.update_all(canvas_course_id: canvas_course_id)
  # end

  validates :canvas_id, uniqueness: true, presence: true
  belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
  has_many :enrollments, primary_key: :canvas_id, foreign_key: :canvas_section_id

  api_syncable({
    sis_id: :sis_section_id,
    canvas_course_id: :course_id,
    canvas_nonxlist_course_id: :nonxlist_course_id,
    name: :name,
    start_at: :start_at,
    end_at: :end_at,
    workflow_state: ->(r){ 'active' },
  }, -> (api) { api.section(canvas_id) })
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
canvas_sync-0.21.0.beta5 spec/dummy/app/models/section.rb
canvas_sync-0.21.0.beta4 spec/dummy/app/models/section.rb
canvas_sync-0.21.0.beta3 spec/dummy/app/models/section.rb
canvas_sync-0.21.0.beta2 spec/dummy/app/models/section.rb
canvas_sync-0.21.0.beta1 spec/dummy/app/models/section.rb