diff --git a/lib/has_calendar.rb b/lib/has_calendar.rb index a39157d..9ed1434 100644 --- a/lib/has_calendar.rb +++ b/lib/has_calendar.rb @@ -53,7 +53,12 @@ def calendar(options={}, &block) private def group_events(events, field) - events.group_by { |event| event.send(field).to_date.jd } if events + if events + field = event.send(field) + grouped_events = events.group_by { |event| field.to_date.jd if field} + grouped_events.delete(nil) + grouped_events + end end def days_for_calendar