debian-mirror-gitlab/app/models/preloaders/merge_requests_preloader.rb
2021-11-11 11:23:49 +05:30

19 lines
466 B
Ruby

# frozen_string_literal: true
module Preloaders
class MergeRequestsPreloader
attr_reader :merge_requests
def initialize(merge_requests)
@merge_requests = merge_requests
end
def execute
preloader = ActiveRecord::Associations::Preloader.new
preloader.preload(merge_requests, { target_project: [:project_feature] })
merge_requests.each do |merge_request|
merge_request.lazy_upvotes_count
end
end
end
end