Sha256: e3c0b8da16e29d9360444ba68b6ebe4fc571c4a48d900037e92c2f13202b5704

Contents?: true

Size: 918 Bytes

Versions: 7

Compression:

Stored size: 918 Bytes

Contents

# <%= autogenerated_model_warning %>

class Enrollment < ApplicationRecord
  include CanvasSync::ApiSyncable

  validates :canvas_id, uniqueness: true, presence: true
  belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true
  belongs_to :role, primary_key: :canvas_id, foreign_key: :canvas_role_id, optional: true
  belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
  belongs_to :section, primary_key: :canvas_id, foreign_key: :canvas_section_id, optional: true

  api_syncable({
    canvas_id: :id,
    canvas_course_id: :course_id,
    course_sis_id: :sis_course_id,
    canvas_user_id: :user_id,
    user_sis_id: :sis_user_id,
    canvas_section_id: :course_section_id,
    role: :role,
    canvas_role_id: :role_id,
    base_role_type: :type,
    workflow_state: :enrollment_state,
  }, -> (api) { api.enrollment("self", canvas_id) })
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
canvas_sync-0.11.1 lib/canvas_sync/generators/templates/models/enrollment.rb
canvas_sync-0.12.0 lib/canvas_sync/generators/templates/models/enrollment.rb
canvas_sync-0.11.0 lib/canvas_sync/generators/templates/models/enrollment.rb
canvas_sync-0.10.6 lib/canvas_sync/generators/templates/models/enrollment.rb
canvas_sync-0.10.5 lib/canvas_sync/generators/templates/models/enrollment.rb
canvas_sync-0.10.4 lib/canvas_sync/generators/templates/models/enrollment.rb
canvas_sync-0.10.3 lib/canvas_sync/generators/templates/models/enrollment.rb