Sha256: 4ff85b1e8891af7eb84027f3af409cf63295b73feeb664f317df19890f7801de

Contents?: true

Size: 615 Bytes

Versions: 3

Compression:

Stored size: 615 Bytes

Contents

<%= autogenerated_model_warning %>

class Section < ApplicationRecord
  include CanvasSync::ApiSyncable

  validates :canvas_section_id, uniqueness: true, presence: true
  belongs_to :course, primary_key: :canvas_course_id, foreign_key: :canvas_course_id, optional: true
  has_many :enrollments, primary_key: :canvas_section_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_date: :start_at,
    end_date: :end_at,
  }, -> (api) { api.section(canvas_section_id) })
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
canvas_sync-0.9.4 lib/canvas_sync/generators/templates/models/section.rb
canvas_sync-0.9.3 lib/canvas_sync/generators/templates/models/section.rb
canvas_sync-0.9.2 lib/canvas_sync/generators/templates/models/section.rb