在我的Invitation.ics文件中,我所看到的只是#<Icalendar::Calendar:0xb299a54>
我尝试实现此链接的日历对象,但是我获得了与该对象相同的.ics文件。我是红宝石的新手。任何人都可以给我推荐一个更好的教程,有关如何发送Google日历,Outlook,ical的日历邀请。到目前为止,这是代码。
class MeetingNotification < ActionMailer::Base
# include Icalendar
def meeting_request_with_calendar
mail(:to => "[email protected]", :subject => "iCalendar",
:from => "[email protected]") do |format|
format.ics {
ical = Icalendar::Calendar.new
e = Icalendar::Event.new
e.start = DateTime.now.utc
e.start.icalendar_tzid="UTC" # set timezone as "UTC"
e.end = (DateTime.now + 1.day).utc
e.end.icalendar_tzid="UTC"
e.organizer "[email protected]"
e.uid "MeetingRequest"
e.summary "Scrum Meeting"
e.description <<-EOF
Venue: Office
Date: 16 August 2013
Time: 10 am
EOF
ical.add_event(e)
ical.publish
ical.to_ical
render :text => ical, :layout => false
}
end
end
我可能来不及回答..我有同样的问题。我通过to_ical
在使用render方法时进行调用来修复它。试试这个
render :text => ical.to_ical
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句