gpt4 book ai didi

ruby-on-rails-3 - 从 View 创建 ics/ical

转载 作者:行者123 更新时间:2023-12-04 06:19:00 27 4
gpt4 key购买 nike

我正在尝试将事件呈现为 ics 和 vcs。我有两个 build 者设置

show.ics.erb
show.vcs.erb

但我不确定如何设置 View 以做出相应的响应。我试过了:
respond_to do |format|
format.html { render :layout => "open_dashboard" }
format.ics { }
format.vcs { }
end

但这不起作用。日志有:
Started GET "/events/1.vcal" for 127.0.0.1 at 2011-07-27 11:47:36 -0500
Processing by EventsController#show as
Parameters: {"id"=>"1"}
Consultation Load (0.9ms) SELECT "event".* FROM "events" WHERE "events"."id" = 1 LIMIT 1
User Load (34.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Rendered events/show.html.erb within layouts/open_dashboard (153.8ms)
Completed 406 Not Acceptable in 237ms (Views: 124.5ms | ActiveRecord: 35.2ms)

那么如何让它呈现正确的 View 呢?

最佳答案

您是否记得在 config/initializers/mime_types.rb 中注册您的自定义 mime 类型? ?

类似 Mime::Type.register "text/calendar", :ics可能对 .ics 有用.

关于ruby-on-rails-3 - 从 View 创建 ics/ical,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6848178/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com