mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
Shown on Admin -> About, in the software history, records package, procedures and sam:doctor; release notes in the app under Help. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
713 B
Ruby
20 lines
713 B
Ruby
# Which software versions have run, and when (AC 120-78B 3.2.6): recorded
|
|
# when the app starts and by the nightly check.
|
|
class AppRevision < ApplicationRecord
|
|
scope :latest_first, -> { order(first_seen_at: :desc) }
|
|
|
|
def self.touch_current!
|
|
revision = SystemInfo.new.revision
|
|
return if revision.blank? || revision == "unknown"
|
|
now = Time.current
|
|
record = find_or_initialize_by(revision: revision)
|
|
record.first_seen_at ||= now
|
|
record.built_at ||= SystemInfo.new.built_at
|
|
record.version ||= SystemInfo.new.version
|
|
record.last_seen_at = now
|
|
record.save!
|
|
rescue ActiveRecord::ActiveRecordError => e
|
|
Rails.logger.warn("[app revisions] #{e.class}: #{e.message}")
|
|
end
|
|
end
|