2

我想将 Rails 日历与 Google 日历等本地设备日历同步。我已将我的 Rails 日历转换为 .ics 格式。我该如何前进?这就是我创建它的方式:控制器:

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

在视图中:

<%= link_to 'sync to my calendar',:format => :ics, :controller => 'talent_calendar_events', :protocol => "webcal",  :action => :index %>
4

0 回答 0