2018-11-02 15:43:07 -04:00
|
|
|
# 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)
|
2021-04-22 14:10:13 -04:00
|
|
|
ActiveRecord::Associations::Preloader.new.preload(members, :created_by)
|
|
|
|
ActiveRecord::Associations::Preloader.new.preload(members, user: :status)
|
|
|
|
ActiveRecord::Associations::Preloader.new.preload(members, user: :u2f_registrations)
|
2021-12-15 19:15:50 -05:00
|
|
|
ActiveRecord::Associations::Preloader.new.preload(members, user: :webauthn_registrations) if Feature.enabled?(:webauthn, default_enabled: :yaml)
|
2018-11-02 15:43:07 -04:00
|
|
|
end
|
|
|
|
end
|
2020-05-14 08:08:21 -04:00
|
|
|
|
2021-05-11 17:10:21 -04:00
|
|
|
MembersPreloader.prepend_mod_with('MembersPreloader')
|