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:
@@ -59,6 +59,7 @@ class QuantitiesController < ApplicationController
|
||||
private
|
||||
|
||||
def quantity_params
|
||||
params[:quantity].delete(:formula) if params[:quantity][:formula].blank?
|
||||
params.require(:quantity).permit(
|
||||
:domain,
|
||||
:parent_id,
|
||||
|
||||
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user