diff --git a/app/models/procedure_revision.rb b/app/models/procedure_revision.rb index a8ad60d9f..a1839ae36 100644 --- a/app/models/procedure_revision.rb +++ b/app/models/procedure_revision.rb @@ -155,15 +155,11 @@ class ProcedureRevision < ApplicationRecord end def children_of(tdc) - parent_revision_type_de_champ = revision_types_de_champ.find_by(type_de_champ: tdc) + parent_coordinate_id = revision_types_de_champ.where(type_de_champ: tdc).select(:id) - if parent_revision_type_de_champ.present? - types_de_champ - .where(procedure_revision_types_de_champ: { parent_id: parent_revision_type_de_champ.id }) - .order("procedure_revision_types_de_champ.position") - else - TypeDeChamp.none - end + types_de_champ + .where(procedure_revision_types_de_champ: { parent_id: parent_coordinate_id }) + .order("procedure_revision_types_de_champ.position") end private