debian-mirror-gitlab/app/models/members_preloader.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
420 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
class MembersPreloader
attr_reader :members
def initialize(members)
@members = members
end
def preload_all
2023-05-27 22:25:52 +05:30
ActiveRecord::Associations::Preloader.new(
records: members,
associations: [
:source,
:created_by,
2023-06-20 00:43:36 +05:30
{ user: [:status, :webauthn_registrations] }
2023-05-27 22:25:52 +05:30
]
).call
2018-12-13 13:39:08 +05:30
end
end
2020-05-24 23:13:21 +05:30
2021-06-08 01:23:25 +05:30
MembersPreloader.prepend_mod_with('MembersPreloader')