From 8194cd82d7cb70c5b81bec8ee7a82b542c2570e9 Mon Sep 17 00:00:00 2001 From: hukl Date: Thu, 10 Sep 2009 13:29:14 +0200 Subject: show the next event if none are found for the next 14 days. Closes #19 --- app/models/occurrence.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/models') diff --git a/app/models/occurrence.rb b/app/models/occurrence.rb index 667ba6f..591e1e0 100644 --- a/app/models/occurrence.rb +++ b/app/models/occurrence.rb @@ -20,6 +20,15 @@ class Occurrence < ActiveRecord::Base ) end + def self.find_next + find( + :all, + :limit => 1, + :include => :node, + :conditions => ["start_time > ?", Time.now] + ) + end + # Deletes all Occurrences which belong to the given event. Afterwards a few # variables are set to save repetitive queries. The occurrences of the given # event are then calculated and created. -- cgit v1.3