diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b4854da47..f3ba40f1d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -9,13 +9,13 @@ class UsersController < ApplicationController def index redirect_to users_organisation_path(current_user.organisation) unless current_user.support? - @pagy, @users = pagy(User.all.where(active: true)) + @pagy, @users = pagy(User.all.where(active: true).includes(:organisation)) respond_to do |format| format.html format.csv do if current_user.support? - send_data User.all.where(active: true).to_csv, filename: "users-#{Time.zone.now}.csv" + send_data User.all.where(active: true).includes(:organisation).to_csv, filename: "users-#{Time.zone.now}.csv" else head :unauthorized end