Procedure and expert link

This commit is contained in:
simon lehericey 2021-01-07 15:45:02 +01:00 committed by kara Diaby
parent 29e9f2dd32
commit d409a9a6c5
5 changed files with 59 additions and 1 deletions

View file

@ -0,0 +1,16 @@
# == Schema Information
#
# Table name: experts_procedures
#
# id :bigint not null, primary key
# allow_decision_access :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
# expert_id :bigint not null
# procedure_id :bigint not null
#
class ExpertsProcedure < ApplicationRecord
belongs_to :expert
belongs_to :procedure
validates :expert, uniqueness: { scope: :procedure }
end

View file

@ -70,6 +70,9 @@ class Procedure < ApplicationRecord
has_many :all_types_de_champ, -> { joins(:procedure).where('types_de_champ.revision_id != procedures.draft_revision_id').ordered }, through: :revisions, source: :types_de_champ
has_many :all_types_de_champ_private, -> { joins(:procedure).where('types_de_champ.revision_id != procedures.draft_revision_id').ordered }, through: :revisions, source: :types_de_champ_private
has_many :experts_procedures, dependent: :destroy
has_many :experts, through: :experts_procedures
has_one :module_api_carto, dependent: :destroy
has_one :attestation_template, dependent: :destroy