gitlab-org--gitlab-foss/app/controllers/concerns/members_presentation.rb
James Edwards-Jones d76fdfcfdb Add MembersPreloader to fix ActiveRecord cop
MembersPresentation was previously preloading records and we wanted to
extend this in
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/5807

By moving this to MembersPreloader we avoid introducing a new cop
exception that would otherwise have been needed
in EE::MembersPresentation
2018-11-02 21:38:58 +00:00

18 lines
403 B
Ruby

# frozen_string_literal: true
module MembersPresentation
extend ActiveSupport::Concern
def present_members(members)
preload_associations(members)
Gitlab::View::Presenter::Factory.new(
members,
current_user: current_user,
presenter_class: MembersPresenter
).fabricate!
end
def preload_associations(members)
MembersPreloader.new(members).preload_all
end
end