Skip to content

Commit 6390464

Browse files
authored
Merge pull request #2561 from ekylibre/debug/fix-two-clicks-intervention-creation
Add a default value of 1 for quantity_population of InterventionOutput
2 parents 0ca3e8a + 42d403d commit 6390464

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/models/intervention_output.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ class InterventionOutput < InterventionProductParameter
6363
has_one :product_movement, as: :originator, dependent: :destroy
6464
validates :variant, :quantity_population, presence: true
6565

66+
after_initialize do
67+
next if persisted?
68+
69+
self.quantity_population ||= 1
70+
end
71+
6672
after_save do
6773
unless destroyed?
6874
output = product

0 commit comments

Comments
 (0)