Skip to content

Commit

Permalink
Only run image count validation when images are required
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorbg committed Oct 29, 2024
1 parent 16aa4f7 commit 6ced50e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/delegate_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def md_section_defaults!
validates :wrc_incidents, presence: true, if: :wrc_feedback_requested
validates :wic_incidents, presence: true, if: :wic_feedback_requested

validate :setup_image_count, if: :posted?
validate :setup_image_count, if: [:posted?, :requires_setup_images?]
private def setup_image_count
if self.setup_images.count < self.required_setup_images_count
errors.add(:setup_images, "Needs at least #{self.required_setup_images_count} images")
Expand Down

0 comments on commit 6ced50e

Please sign in to comment.