procedure: fix query for finding champs without stable_id

It would break on ActiveRecord 6.1.
This commit is contained in:
Pierre de La Morinerie 2021-02-17 17:33:08 +00:00 committed by Paul Chavard (Rebase PR Action)
parent 7c44662f23
commit 9537342c06

View file

@ -541,7 +541,10 @@ class Procedure < ApplicationRecord
end
def populate_champ_stable_ids
TypeDeChamp.where(procedure: self, stable_id: nil).find_each do |type_de_champ|
TypeDeChamp
.joins(:revisions)
.where(procedure_revisions: { procedure_id: id }, stable_id: nil)
.find_each do |type_de_champ|
type_de_champ.update_column(:stable_id, type_de_champ.id)
end
end