Allow cascade delete Unit/Quantity

Closes #32
This commit is contained in:
2026-02-22 17:50:43 +01:00
parent 1ba7d29441
commit 80130fb7d1
9 changed files with 19 additions and 17 deletions

View File

@@ -12,10 +12,10 @@ class User < ApplicationRecord
disabled: 0, # administratively disallowed to sign in
}, default: :active, validate: true
has_many :readouts, dependent: :destroy
has_many :readouts, dependent: :delete_all
accepts_nested_attributes_for :readouts
has_many :quantities, dependent: :destroy
has_many :units, dependent: :destroy
has_many :quantities, dependent: :delete_all
has_many :units, dependent: :delete_all
validates :email, presence: true, uniqueness: true,
length: {maximum: type_for_attribute(:email).limit}