class Restore < ApplicationRecord
  include Base::Restore

  associations_for legacy: true do |a|
    a.belongs_to :school
  end

  belongs_to :associated, polymorphic: true

  scope :by_students, -> { where(associated_type: 'Student') }

  def model_params
    JSON.parse(properties).merge(id: associated_id || primary_id)
  end
end
