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: merge_request_diff_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
  # This class preloads the `merge_request_diff` association for the given merge request models.
  #
  # Usage:
  #   merge_requests = MergeRequest.where(...)
  #   Preloaders::MergeRequestDiffPreloader.new(merge_requests).preload_all
  #  
    
    def preload_all
      merge_request_diffs = MergeRequestDiff.latest_diff_for_merge_requests(@merge_requests)
      cache = merge_request_diffs.index_by { |diff| diff.merge_request_id }

      @merge_requests.each do |merge_request|
        merge_request_diff = cache[merge_request.id]

        merge_request.association(:merge_request_diff).target = merge_request_diff
        merge_request.association(:merge_request_diff).loaded!
      end
    end