我正在使用rails 3和ri_cal gem。我无法生成有效的.ics文件。它会生成,但AppleCalendar或GoogleCalendar表示它是空的。我做错了什么? 感谢提前感谢:)
我的控制器
class WebsitesController < ApplicationController
def index
respond_to do |format|
format.ics
end
end
end
和index.ics.builer
RiCal.Calendar do
event do
description "MA-6 First US Manned Spaceflight"
dtstart DateTime.parse("2/20/1962 14:47:39")
dtend DateTime.parse("2/20/1962 19:43:02")
location "Cape Canaveral"
add_attendee "john.glenn@nasa.gov"
alarm do
description "Segment 51"
end
end
end
答案 0 :(得分:3)
我能够成功获得由
创建的ICSdef index
cal =RiCal.Calendar do
event do
description "MA-6 First US Manned Spaceflight"
dtstart DateTime.parse("1962-02-20")
dtend DateTime.parse("1962-02-20")
location "Cape Canaveral"
add_attendee "john.glenn@nasa.gov"
alarm do
description "Segment 51"
end
end
end
respond_to do |format|
format.ics { send_data(cal.export, :filename=>"mycal.ics", :disposition=>"inline; filename=mycal.ics", :type=>"text/calendar")}
end
end
不需要离散构建器