# frozen_string_literal: true

class AgendaDay < ApplicationRecord
  has_many :times, class_name: 'AgendaTime', inverse_of: :day,
                   dependent: :destroy, foreign_key: :day_id

  validates :label, presence: true

  def name
    "#{label} (#{date})"
  end
end

# frozen_string_literal: true

class AgendaDay < ApplicationRecord
  has_many :times, class_name: 'AgendaTime', inverse_of: :day,
                   dependent: :destroy

  validates :label, presence: true

  def name
    "#{label} (#{date})"
  end
end

--- 
+++ 
@@ -2,7 +2,7 @@
 
 class AgendaDay < ApplicationRecord
   has_many :times, class_name: 'AgendaTime', inverse_of: :day,
-                   dependent: :destroy
+                   dependent: :destroy, foreign_key: :day_id
 
   validates :label, presence: true
 
Add missing foreign_key config for agenda day association
