add expert logic

This commit is contained in:
kara Diaby 2021-02-09 10:24:13 +01:00
parent 3cfbe38a8b
commit d2ab2debb6
15 changed files with 311 additions and 3 deletions

View file

@ -8,8 +8,17 @@
#
class Expert < ApplicationRecord
has_one :user
has_many :experts_procedures
has_many :avis, through: :experts_procedures
has_many :dossiers, through: :avis
default_scope { eager_load(:user) }
def email
user.email
end
def self.by_email(email)
Expert.eager_load(:user).find_by(users: { email: email })
end
end