models: return procedure revisions in deterministic order

Fixes a randomly-failing spec in spec/models/procedure_revision_spec.rb.
This commit is contained in:
Pierre de La Morinerie 2020-08-13 12:58:10 +02:00
parent 378fd508b4
commit c01d640997

View file

@ -58,7 +58,7 @@ class Procedure < ApplicationRecord
has_many :types_de_champ, -> { root.public_only.ordered }, inverse_of: :procedure, dependent: :destroy has_many :types_de_champ, -> { root.public_only.ordered }, inverse_of: :procedure, dependent: :destroy
has_many :types_de_champ_private, -> { root.private_only.ordered }, class_name: 'TypeDeChamp', inverse_of: :procedure, dependent: :destroy has_many :types_de_champ_private, -> { root.private_only.ordered }, class_name: 'TypeDeChamp', inverse_of: :procedure, dependent: :destroy
has_many :revisions, class_name: 'ProcedureRevision', inverse_of: :procedure, dependent: :destroy has_many :revisions, -> { order(:id) }, class_name: 'ProcedureRevision', inverse_of: :procedure, dependent: :destroy
belongs_to :draft_revision, class_name: 'ProcedureRevision', optional: true belongs_to :draft_revision, class_name: 'ProcedureRevision', optional: true
belongs_to :published_revision, class_name: 'ProcedureRevision', optional: true belongs_to :published_revision, class_name: 'ProcedureRevision', optional: true
has_many :deleted_dossiers, dependent: :destroy has_many :deleted_dossiers, dependent: :destroy