Method: DateBook::ActsAsEvent::InstanceMethods#previous_occurrence

Defined in:
lib/date_book/concerns/acts_as_event.rb

#previous_occurrence(occurrence = nil) ⇒ Object



51
52
53
54
# File 'lib/date_book/concerns/acts_as_event.rb', line 51

def previous_occurrence(occurrence = nil)
  before = occurrence.present? ? occurrence.start_date : Time.now
  event_occurrences.starting_before(before).descending.first
end