You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: provisioning_template.rb
    path of file: ./repos/foreman/app/models
    
    the code of the file until where you have to start completion: class ProvisioningTemplate < Template
  audited
  has_many :audits, :as => :auditable, :class_name => Audited.audit_class.name

  include Authorizable
  extend FriendlyId
  friendly_id :name
  include Parameterizable::ByIdName
  include DirtyAssociations
  include TaxonomyCollisionFinder

  class << self
    # we have to override the base_class because polymorphic associations does not detect it correctly, more details at
    # http://apidock.com/rails/ActiveRecord/Associations/ClassMethods/has_many#1010-Polymorphic-has-many-within-inherited-class-gotcha
    def base_class
      self
    end
  end
  self.table_name = 'templates'

  validates :name, :uniqueness => true
  validates :template_kind_id, :presence => true, :unless => proc { |t| t.snippet }

  before_destroy EnsureNotUsedBy.new(:hostgroups, :os_def
    
  def self.build_pxe_default
    return [:unprocessable_entity, _("No TFTP proxies defined, can't continue")] if (proxies = SmartProxy.with_features("TFTP")).empty?
    error_msgs = []
    used_templates = []
    TemplateKind::PXE.each do |kind|
      next if kind == 'iPXE'
      global_template_name = global_template_name_for(kind)
      if (default_template = find_global_default_template global_template_name, kind).nil?
        error_msgs << _("Could not find a Configuration Template with the name \"%s\", please create one.") % global_template_name
      else
        begin
          @profiles = pxe_default_combos
          menu = default_template.render(variables: { profiles: @profiles })
        rescue => exception
          Foreman::Logging.exception("Cannot render '#{global_template_name}'", exception)
          error_msgs << "#{exception.message} (#{kind})"
        end
        return [:unprocessable_entity, error_msgs.join(', ')] unless error_msgs.empty?
        proxies.each do |proxy|
          tftp = ProxyAPI::TFTP.new(:url => proxy.url)
          tftp.create_default(kind, {:menu => menu})
          fetch_boot_files_combo(tftp)
        rescue => exception
          Foreman::Logging.exception("Cannot deploy rendered template '#{global_template_name}' to '#{proxy}'", exception)
          error_msgs << "#{proxy}: #{exception.message} (#{kind})"
        end
      end