From 5d38f1e3a56a45b402e996502cdb10c84364e77c Mon Sep 17 00:00:00 2001 From: Nicolas Florentin Date: Tue, 5 Apr 2016 09:57:09 +0200 Subject: [PATCH] does not validate length of availability if start_at or end_at are blank and already missing --- app/models/availability.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/availability.rb b/app/models/availability.rb index d360b3861..0790fdc8f 100644 --- a/app/models/availability.rb +++ b/app/models/availability.rb @@ -20,7 +20,8 @@ class Availability < ActiveRecord::Base attr_accessor :is_reserved, :slot_id, :can_modify - validate :length_must_be_1h_minimum + validates :start_at, :end_at, presence: true + validate :length_must_be_1h_minimum, unless: proc { end_at.blank? or start_at.blank? } validate :should_be_associated def safe_destroy