From 890359c077dd531a1268e90fc44dd0b14274d1a8 Mon Sep 17 00:00:00 2001 From: pabois <pierreandre.boissinot@noesya.coop> Date: Thu, 28 Oct 2021 10:58:28 +0200 Subject: [PATCH] researchers now scoped to current_university --- app/models/user.rb | 3 ++- app/views/admin/research/researchers/_form.html.erb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 6ab66091b..67d95f094 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -66,6 +66,7 @@ class User < ApplicationRecord scope :ordered, -> { order(:last_name, :first_name) } def to_s - "#{first_name} #{last_name}" + "#{last_name} #{first_name}" end + end diff --git a/app/views/admin/research/researchers/_form.html.erb b/app/views/admin/research/researchers/_form.html.erb index aea62c4a0..aa0ad38d1 100644 --- a/app/views/admin/research/researchers/_form.html.erb +++ b/app/views/admin/research/researchers/_form.html.erb @@ -3,7 +3,7 @@ <div class="col-md-4"> <%= f.input :first_name %> <%= f.input :last_name %> - <%= f.association :user %> + <%= f.association :user, collection: current_university.users.ordered %> </div> <div class="col-md-8"> <%= f.input :biography, input_html: { rows: 5 } %> -- GitLab