Publishing an ical calendar?

I have a table of events and want to create an action in one of my
controllers to allow people to subscribe to an ical so these events will
show up in their calendar. Any ideas on how I would do this? I couldnt
find anything on google.

Thanks.

Ben J. wrote:

I have a table of events and want to create an action in one of my
controllers to allow people to subscribe to an ical so these events will
show up in their calendar. Any ideas on how I would do this? I couldnt
find anything on google.

Thanks.

I’ve done this before. you need to be generating iCalendar (ex
vcalendar) files which is a reasonably simple text based format, defined
by http://www.ietf.org/rfc/rfc2445.txt (see the bottom of that document
for some actual examples.

Fred

On 24 Sep 2007, at 13:32, Ben J. wrote:

I have a table of events and want to create an action in one of my
controllers to allow people to subscribe to an ical so these events
will show up in their calendar. Any ideas on how I would do this? I
couldnt find anything on google.

The icalendar gem can help with that:

http://icalendar.rubyforge.org/

I’m using it along these lines:

class EventsController < ActionController::Base
def index
@events = Event.find(:all)

respond_to do |format|
  format.html

  format.ics do
    cal = Calendar.new
          @events.each do |event|
           cal_event = Event.new
           cal_event.start = event.starts_at
           cal_event.summary = 'My title'
           cal_event.description "My Description"
           cal.add_event(cal_event.to_ical)
         end
         render :text => cal.to_ical
       end
 end

end
end

James.


James S.
Play: http://james.anthropiccollective.org
Work: Processing Greenbelt 2009 – James Stewart