From db98f0e00e547f71dec604dd6b47023709bc838a Mon Sep 17 00:00:00 2001 From: LindseyRenken Date: Sun, 7 May 2017 16:56:54 +0300 Subject: [PATCH] Fixed to_time on nil class error --- lib/schedulable/acts_as_schedulable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/schedulable/acts_as_schedulable.rb b/lib/schedulable/acts_as_schedulable.rb index 5cd12a5..ce4ce6e 100644 --- a/lib/schedulable/acts_as_schedulable.rb +++ b/lib/schedulable/acts_as_schedulable.rb @@ -88,7 +88,7 @@ def acts_as_schedulable(name, options = {}) max_period = Schedulable.config.max_build_period || 1.year max_date = now + max_period - max_date = terminating ? [max_date, schedule.last.to_time].min : max_date + max_date = terminating && schedule.last ? [max_date, schedule.last.to_time].min : max_date max_count = Schedulable.config.max_build_count || 100 max_count = terminating && schedule.remaining_occurrences.any? ? [max_count, schedule.remaining_occurrences.count].min : max_count