Sha256: 5214cc6f5b683ae13a7bb2d39a0c3ed2cccfed93e2e0d36eb6ff0854107530db

Contents?: true

Size: 980 Bytes

Versions: 3

Compression:

Stored size: 980 Bytes

Contents

# <%= autogenerated_model_warning %>

class User < ApplicationRecord
  include CanvasSync::Record
  include CanvasSync::Concerns::ApiSyncable

  canvas_sync_features :defaults

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

  api_syncable({
    sis_id: :sis_user_id,
    email: :email,
    login_id: :login_id,
    name: :name,
    sortable_name: :sortable_name,
    first_name: :short_name,
  }, -> (api) { api.user_detail(canvas_id) })
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
canvas_sync-0.20.5 lib/canvas_sync/generators/templates/models/user.rb
canvas_sync-0.20.4 lib/canvas_sync/generators/templates/models/user.rb
canvas_sync-0.20.3 lib/canvas_sync/generators/templates/models/user.rb