From db615a04c76317dd99d5f450ed4ac56e210af75d Mon Sep 17 00:00:00 2001 From: pabois <pierreandre.boissinot@noesya.coop> Date: Mon, 11 Oct 2021 10:33:02 +0200 Subject: [PATCH] user --- app/models/user.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index af96e0403..85cf3e774 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -62,8 +62,12 @@ class User < ApplicationRecord has_one :researcher, class_name: 'Research::Researcher' has_one_attached :picture + valida + + scope :ordered, -> { order(:last_name, :first_name) } + + def to_s - (first_name.present? || last_name.present?) ? "#{first_name} #{last_name}" - : "#{email}" + "#{first_name} #{last_name}" end end -- GitLab