4

在我的invite.ics 文件中,我看到的只是#<Icalendar::Calendar:0xb299a54> 我尝试实现此链接的日历对象,但我得到了与该对象相同的.ics 文件。我是红宝石新手。任何人都可以向我推荐一个更好的关于发送谷歌日历、outlook、ical 日历邀请的教程。这是到目前为止的代码。

class MeetingNotification < ActionMailer::Base
  # include Icalendar
   def meeting_request_with_calendar
     mail(:to => "ashi_12@gmail.com", :subject => "iCalendar",
                  :from => "tester@gmail.com") 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 "tester@gmail.com"
       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
4

1 回答 1

3

我可能来不及回答..我有同样的问题。to_ical我通过在使用渲染方法时调用来修复它。尝试这个

render :text => ical.to_ical
于 2013-09-10T10:57:51.300 回答