Class: MembersPreloader

Inherits:
Object
  • Object
show all
Defined in:
app/models/members_preloader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(members) ⇒ MembersPreloader

Returns a new instance of MembersPreloader.


6
7
8
# File 'app/models/members_preloader.rb', line 6

def initialize(members)
  @members = members
end

Instance Attribute Details

#membersObject (readonly)

Returns the value of attribute members.


4
5
6
# File 'app/models/members_preloader.rb', line 4

def members
  @members
end

Instance Method Details

#preload_allObject


10
11
12
13
14
15
16
17
# File 'app/models/members_preloader.rb', line 10

def preload_all
  ActiveRecord::Associations::Preloader.new.preload(members, :user)
  ActiveRecord::Associations::Preloader.new.preload(members, :source)
  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)
  ActiveRecord::Associations::Preloader.new.preload(members, user: :webauthn_registrations) if Feature.enabled?(:webauthn)
end