Add park <-> alert relations

This commit is contained in:
2025-10-08 00:22:11 -07:00
parent 8937ca9fc9
commit 4c3ddc6175
3 changed files with 9 additions and 1 deletions

View File

@@ -1,2 +1,4 @@
class Alert < ApplicationRecord
belongs_to :park, foreign_key: :park_code, primary_key: :code,
inverse_of: :alerts
end

View File

@@ -1,2 +1,4 @@
class Park < ApplicationRecord
has_many :alerts, foreign_key: :park_code, primary_key: :code,
inverse_of: :park, dependent: :destroy
end