Sha256: e86aee284dd63d9edf681626891d9e889446a1b580c567e252243b5fb734143c

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 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 Account < ApplicationRecord
  include CanvasSync::Record
  include CanvasSync::Concerns::ApiSyncable
  # include CanvasSync::Concerns::Account::Ancestry # Add support for the ancestry Gem

  canvas_sync_features :defaults

  validates :canvas_id, uniqueness: true, presence: true

  has_many :admins, primary_key: :canvas_id, foreign_key: :canvas_account_id
  belongs_to :canvas_parent, class_name: 'Account', optional: true,
                             primary_key: :canvas_id, foreign_key: :canvas_parent_account_id
  has_many :sub_accounts, class_name: 'Account',
                          primary_key: :canvas_id, foreign_key: :canvas_parent_account_id
  has_many :groups, primary_key: :canvas_id, foreign_key: :canvas_account_id

  scope :active, -> { where.not(workflow_state: 'deleted') }
  # scope :should_canvas_sync, -> { active } # Optional - uses .active if not given

  api_syncable({
    name: :name,
    workflow_state: :workflow_state,
    canvas_parent_account_id: :parent_account_id,
  }, -> (api) { api.account(canvas_id) })
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
canvas_sync-0.20.5 spec/dummy/app/models/account.rb
canvas_sync-0.20.4 spec/dummy/app/models/account.rb
canvas_sync-0.20.3 spec/dummy/app/models/account.rb
canvas_sync-0.19.1.beta2 spec/dummy/app/models/account.rb
canvas_sync-0.19.1.beta1 spec/dummy/app/models/account.rb
canvas_sync-0.19.0 spec/dummy/app/models/account.rb