# # # 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 Rubric < ApplicationRecord include CanvasSync::Record include CanvasSync::Concerns::ApiSyncable canvas_sync_features :defaults validates :canvas_id, uniqueness: true, presence: true belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true belongs_to :rubric, primary_key: :canvas_id, foreign_key: :canvas_rubric_id , optional: true # based on another rubric belongs_to :context, polymorphic: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type, optional: true has_many :rubric_assessments, through: :rubric_associations, dependent: :destroy has_many :rubric_associations, primary_key: :canvas_id, foreign_key: :canvas_rubric_id has_many :associated_objects, through: :rubric_associations, source: :association_object api_syncable({ canvas_id: :id, title: :title, canvas_context_id: :context_id, canvas_context_type: :context_type, points_possible: :points_possible, reusable: :reusable, read_only: :read_only, free_form_criterion_comments: :free_form_criterion_comments, hide_score_total: :hide_score_total, data: :data, }, -> (api) { api.get("api/v1/accounts/#{canvas_root_account_id}/rubrics/#{canvas_id}") }) end