Record history for ADs and inspection types (applicability links and changes), with restore

Shared records keep applicability in join tables, so linking to the
airframe or a component, unlinking, edits to the shared record and a
component's deletion are now appended to each affected aircraft's hash
chain. Owners can restore a removed link from Activity -> Record history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-11 20:54:35 -05:00
1 parent d5d06d4169
commit ba0455b149
10 files changed
+164 -7

No files matched your search

+2
View File
@@ -19,6 +19,8 @@ class Component < ApplicationRecord
has_many :logbook_entry_parts, dependent: :destroy
has_and_belongs_to_many :inspection_types
has_and_belongs_to_many :airworthiness_directives
# Its AD and inspection links go with it; keep that in the record history.
before_destroy(prepend: true) { (airworthiness_directives.to_a + inspection_types.to_a).each { _1.history_component_deleted(self) } }
validates :manufacturer, :model, :date_in_service, presence: true
validates :status, inclusion: { in: STATUSES.keys }