Sha256: dada6976a6571d4346911654da833146e954e3e791fa59203d7695c276e75abe
Contents?: true
Size: 1009 Bytes
Versions: 57
Compression:
Stored size: 1009 Bytes
Contents
# <%= autogenerated_model_warning %> class Term < ApplicationRecord include CanvasSync::Record include CanvasSync::Concerns::ApiSyncable validates :canvas_id, uniqueness: true, presence: true has_many :courses, foreign_key: :canvas_term_id, primary_key: :canvas_id api_syncable({ canvas_id: :id, name: :name, sis_id: :sis_term_id, start_at: :start_at, end_at: :end_at, workflow_state: :workflow_state, grading_period_group_id: :grading_period_group_id, }, -> (api) { terms = api.terms('self').all_pages! term_data = terms.find{|term| term['id'] == canvas_id } raise Footrest::HttpError::NotFound unless term_data.present? term_data }) # This is a sample scope created by the CanvasSync gem; feel # free to customize it for your tool's requirements. scope :active, -> { where(workflow_state: 'active') .where("start_at <= ? OR start_at IS NULL", 15.days.from_now) .where("end_at >= ? OR end_at IS NULL", 15.days.ago) } end
Version data entries
57 entries across 57 versions & 1 rubygems