1
0

Update Measurements form based on Targets

This commit is contained in:
cryptogopher
2021-05-06 21:52:35 +02:00
parent e301665b6a
commit 74b4dabf86
7 changed files with 76 additions and 79 deletions

View File

@@ -1,10 +1,11 @@
class Readout < QuantityValue
DOMAIN = "measurement"
# Need to specify polymorphic association so :registry_type gets written (see
# QuantityValue for explanation why it's needed)
belongs_to :measurement, inverse_of: :readouts, polymorphic: true, required: true,
foreign_key: 'registry_id', foreign_type: 'registry_type'
# Readout uniqueness NOT validated here, see Value for explanation
validates :value, numericality: true
delegate :completed_at, to: :measurement