Stop crashing when removed repetition row is submitted
This commit is contained in:
parent
6a5722a5e5
commit
1b5aef10f2
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