I have the following setup to generate out an iCal feed, when our digital signage boxes subscribe to the feed at http://foo/rooms/foo/feed.ics they pull in the event information ok, but don’t stop displaying the event. I believe this is because the actual ical file generated by the below function puts the dtend before dtstart. Is there anything I can do to fix this?
def feed
@room = Room.find(params[:id])
@events = @room.events
respond_to do |format|
if @room.valid?
format.ics { render :text => self.generate_ical }
else
format.ics { render :nothing => true, :status => :forbidden}
end
end
end
def generate_ical
RiCal.Calendar do |ical|
ical.add_x_property 'X-WR-CALNAME',@room.name
@events.each do |e|
ical.event do |event|
event.dtstart = e.start
event.dtend = e.end
event.summary = e.summary
end
end
end.export
end
Sounds like the problem is with the feed reader, not the feed generator. The iCal standard does not impose any ordering of properties within an iCalendar object.