Merge pull request #5862 from tchak/fix-champs-repetition
Stop crashing when removed repetition row is submitted
This commit is contained in:
commit
2eae5c4afe
1 changed files with 5 additions and 0 deletions
|
@ -346,6 +346,11 @@ module Users
|
|||
|
||||
if champs_params[:dossier]
|
||||
@dossier.assign_attributes(champs_params[:dossier])
|
||||
# FIXME in some cases a removed repetition bloc row is submitted.
|
||||
# In this case it will be trated as a new records and action will fail.
|
||||
@dossier.champs.filter(&:repetition?).each do |champ|
|
||||
champ.champs = champ.champs.filter(&:persisted?)
|
||||
end
|
||||
if @dossier.champs.any?(&:changed?)
|
||||
@dossier.last_champ_updated_at = Time.zone.now
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue