debian-mirror-gitlab/app/models/members_preloader.rb
2020-11-24 15:15:51 +05:30

19 lines
639 B
Ruby

# frozen_string_literal: true
class MembersPreloader
attr_reader :members
def initialize(members)
@members = members
end
def preload_all
ActiveRecord::Associations::Preloader.new.preload(members, :user)
ActiveRecord::Associations::Preloader.new.preload(members, :source)
ActiveRecord::Associations::Preloader.new.preload(members.map(&:user), :status)
ActiveRecord::Associations::Preloader.new.preload(members.map(&:user), :u2f_registrations)
ActiveRecord::Associations::Preloader.new.preload(members.map(&:user), :webauthn_registrations)
end
end
MembersPreloader.prepend_if_ee('EE::MembersPreloader')