2

I want to sync a rails calendar with local device calendar like Google Calendar. I have converted my rails calendar into an .ics format. How do I move forward? This is how I have created it: controller:

def index
@calendar_events = current_account.calendar_events.active.in_chronological_order.from_today
    respond_to do |samp|
        samp.html
        samp.ics do
          calendar = Icalendar::Calendar.new
          for calendar_event in @calendar_events
            calendar.add_event(calendar_event.to_ics)
          end
          calendar.publish
          render :text => calendar.to_ical
        end
      end
end

in View:

<%= link_to 'sync to my calendar',:format => :ics, :controller => 'talent_calendar_events', :protocol => "webcal",  :action => :index %>
The Hun
  • 145
  • 2
  • 9
  • How did you create the Rails calendar? How did you convert it to .ics? Tell us more about your process so that we may better understand to help you. – sunnyrjuneja Jan 08 '14 at 07:08
  • @SunnyJuneja I have added the code.Have a look at that – The Hun Jan 08 '14 at 08:41
  • I am using rical to create user specific calendars: https://github.com/phoet/on_ruby/blob/master/app/controllers/users_controller.rb#L14 – phoet Jan 08 '14 at 11:07

0 Answers0