lib/canvas_sync/generators/templates/models/section.rb in canvas_sync-0.9.4 vs lib/canvas_sync/generators/templates/models/section.rb in canvas_sync-0.10.0
- old
+ new
@@ -1,18 +1,18 @@
<%= 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
+ validates :canvas_id, uniqueness: true, presence: true
+ belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true
+ has_many :enrollments, primary_key: :canvas_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) })
+ start_at: :start_at,
+ end_at: :end_at,
+ }, -> (api) { api.section(canvas_id) })
end