Sha256: 928a920d949476099bb5c57453d291aafca255f43164d1cc74e8b6a609c79133

Contents?: true

Size: 1.45 KB

Versions: 104

Compression:

Stored size: 1.45 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 Assignment < ApplicationRecord
  include CanvasSync::Record
  include CanvasSync::Concerns::ApiSyncable

  validates :canvas_id, uniqueness: true, presence: true
  belongs_to :context, polymorphic: true, optional: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
  belongs_to :assignment_group, optional: true, primary_key: :canvas_id, foreign_key: :canvas_assignment_group_id
  has_many :submissions, primary_key: :canvas_id, foreign_key: :canvas_assignment_id

  has_many :context_module_items, as: :content, primary_key: :canvas_id, foreign_key: :canvas_content_id, foreign_type: :canvas_content_type, dependent: :destroy
  has_many :context_modules, through: :context_module_items

  api_syncable({
    title: :name,
    description: :description,
    due_at: :due_at,
    unlock_at: :unlock_at,
    lock_at: :lock_at,
    points_possible: :points_possible,
    grading_type: :grading_type,
    submission_types: lambda { |p| p["submission_types"].join(",") },
    canvas_context_id: :course_id,
    canvas_context_type: lambda { |_p| "Course" },
    canvas_assignment_group_id: :assignment_group_id,
    canvas_grading_standard_id: :grading_standard_id,
  }, -> (api) { api.assignment(canvas_context_id, canvas_id) })
end

Version data entries

104 entries across 104 versions & 1 rubygems

Version Path
canvas_sync-0.17.10.beta1 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.8 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.8.beta4 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.8.beta3 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.8.beta2 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.8.beta1 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.7 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.7.beta1 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.6 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.6.beta1 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.5 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.5.beta2 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.5.beta1 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.4 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.3.beta3 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.3.beta2 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.3.beta1 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.2 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.1 spec/dummy/app/models/assignment.rb
canvas_sync-0.17.0 spec/dummy/app/models/assignment.rb