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: project_root_ancestor_preloader.rb
    path of file: ./repos/gitlabhq/app/models/preloaders
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Preloaders
  class ProjectRootAncestorPreloader
    def initialize(projects, namespace_sti_name = :namespace, root_ancestor_preloads = [])
      @projects = projects
      @namespace_sti_name = namespace_sti_name
      @root_ancestor_preloads = root_ancestor_preloads
    end

    def execute
      return unless @projects.is_a?(ActiveRecord::Relation)

      root_query = Namespace.joins("INNER JOIN (#{join_sql}) as root_query ON root_query.root_id = namespaces.id")
                        .sele
    
    def execute
      return unless @projects.is_a?(ActiveRecord::Relation)

      root_query = Namespace.joins("INNER JOIN (#{join_sql}) as root_query ON root_query.root_id = namespaces.id")
                        .select('namespaces.*, root_query.project_id as source_id')

      root_query = root_query.preload(*@root_ancestor_preloads) if @root_ancestor_preloads.any?

      root_ancestors_by_id = root_query.group_by(&:source_id)

      ActiveRecord::Associations::Preloader.new(records: @projects, associations: :namespace).call
      @projects.each do |project|
        root_ancestor = root_ancestors_by_id[project.id]&.first
        project.namespace.root_ancestor = root_ancestor if root_ancestor.present?
      end
    end