1
0

Fix migration of default quantities

Allow Quantity formula to be nil but not blank
Add computed energy quantity
Reverse default quantities deletion order
This commit is contained in:
cryptogopher
2019-11-15 00:04:34 +01:00
parent 0e5a53b4b9
commit 3ce5d5c940
4 changed files with 134 additions and 125 deletions

View File

@@ -15,7 +15,7 @@ class Quantity < ActiveRecord::Base
validate if: -> { parent.present? } do
errors.add(:parent, :parent_domain_mismatch) unless domain == parent.domain
end
validates :formula, formula: true
validates :formula, formula: {allow_nil: true}
after_initialize do
if new_record?