Sha256: dc3d252b2193e0a52059881cbeca96ee7befd5ac5d91885e438a5d8dc63206f7

Contents?: true

Size: 740 Bytes

Versions: 5

Compression:

Stored size: 740 Bytes

Contents

<%= autogenerated_model_warning %>

class User < ApplicationRecord
  include CanvasSync::ApiSyncable

  validates :canvas_user_id, uniqueness: true, presence: true
  has_many :enrollments, primary_key: :canvas_user_id, foreign_key: :canvas_user_id
  has_many :admins, foreign_key: :canvas_user_id, primary_key: :canvas_user_id
  has_many :admin_roles, through: :admins, source: :role
  has_many :submissions, primary_key: :canvas_user_id, foreign_key: :canvas_user_id

  api_syncable({
    sis_id: :sis_id,
    email: :email,
    login_id: :login_id,
    full_name: :name,
    sortable_name: :sortable_name,
    first_name: :first_name,
    last_name: :last_name,
    status: :status,
  }, -> (api) { api.user_detail(canvas_user_id) })
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
canvas_sync-0.9.1 lib/canvas_sync/generators/templates/models/user.rb
canvas_sync-0.9.0 lib/canvas_sync/generators/templates/models/user.rb
canvas_sync-0.8.4 lib/canvas_sync/generators/templates/models/user.rb
canvas_sync-0.8.3 lib/canvas_sync/generators/templates/models/user.rb
canvas_sync-0.8.2 lib/canvas_sync/generators/templates/models/user.rb