Initial commit: Rails port of Simple Aircraft Manager

Rails 8.1 + SQLite rewrite of marbindrakon/simple-aircraft-manager,
designed to self-host as a single container (Solid Queue/Cache/Cable,
Active Storage on disk, Hotwire + importmap, Tailwind).

- Airworthiness engine ported from health/services.py (ADs, grounding
  squawks, inspection recurrency, component replacement)
- Hours updates and flight logs cascading to in-service components,
  optional airworthiness enforcement
- Components, squawks, ADs, inspections, logbook, documents, major
  records, oil/fuel consumption stats and charts, activity log
- Admin/owner/pilot RBAC and public share links (status/maintenance)
- Docker Compose and Kamal deployment, env-driven production config
- Service and integration tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-04 17:59:08 -05:00
commit 38df19c331
264 files changed
+8365

No files matched your search

@@ -0,0 +1,59 @@
class MajorRecordsController < ApplicationController
include AircraftScoped
before_action :require_owner!, except: %i[index show]
before_action :set_record, only: %i[show edit update destroy]
def index
@records = @aircraft.major_records.recent_first.includes(:component)
end
def show; end
def new
@record = @aircraft.major_records.new(record_type: params[:type] || "repair", date_performed: Date.current,
aircraft_hours: @aircraft.tach_time)
end
def create
@record = @aircraft.major_records.new(record_params)
if @record.save
log_event("major_record", "#{@record.type_label} added: #{@record.title}")
redirect_to aircraft_major_records_path(@aircraft), notice: "Record added."
else
render :new, status: :unprocessable_entity
end
end
def edit; end
def update
if @record.update(record_params)
log_event("major_record", "#{@record.type_label} updated: #{@record.title}")
redirect_to aircraft_major_record_path(@aircraft, @record), notice: "Record updated."
else
render :edit, status: :unprocessable_entity
end
end
def destroy
@record.destroy!
log_event("major_record", "#{@record.type_label} deleted: #{@record.title}")
redirect_to aircraft_major_records_path(@aircraft), notice: "Record deleted."
end
private
def set_record = @record = @aircraft.major_records.find(params[:id])
def record_params
p = params.require(:major_record).permit(
:record_type, :title, :description, :date_performed, :performed_by, :component_id,
:form_337_document_id, :stc_number, :stc_holder, :stc_document_id, :logbook_entry_id,
:aircraft_hours, :has_ica, :ica_notes, :notes
)
p[:component_id] = scoped_id(@aircraft.components, p[:component_id])
p[:logbook_entry_id] = scoped_id(@aircraft.logbook_entries, p[:logbook_entry_id])
%i[form_337_document_id stc_document_id].each { |k| p[k] = scoped_id(@aircraft.documents, p[k]) }
p
end
end