From c54004b982957af37ca2ecb415be816e8a86f492 Mon Sep 17 00:00:00 2001 From: Tony Miller Date: Fri, 5 Dec 2025 20:58:09 -0800 Subject: [PATCH] only validate audio_file_name uniqueness on sched show id if sched show is present --- app/models/track.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/track.rb b/app/models/track.rb index 063d5f10..b2b54d64 100644 --- a/app/models/track.rb +++ b/app/models/track.rb @@ -27,7 +27,9 @@ class Track < ActiveRecord::Base # Prevent duplicate audio files for the same scheduled show validates :audio_file_name, uniqueness: { scope: :scheduled_show_id, message: "already exists for this scheduled show" }, - allow_blank: true + allow_blank: true, + if: -> { scheduled_show_id.present? } + before_post_process :transliterate_file_name