2

试图启动 Rails 服务器并收到我不明白的“警告”。有谁知道是什么意思?warning: already initialized constant ICS

这是在上下文中:

meltemi$ rails s
=> Booting WEBrick
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
/Users/meltemi/.rvm/gems/ruby-1.9.3-p0@summit/gems/actionpack-3.1.3/lib/action_dispatch/http/mime_type.rb:101: warning: already initialized constant ICS
[2012-01-15 12:28:34] INFO  WEBrick 1.3.1
[2012-01-15 12:28:34] INFO  ruby 1.9.3 (2011-10-30) [x86_64-darwin11.2.0]
[2012-01-15 12:28:34] INFO  WEBrick::HTTPServer#start: pid=61345 port=3000
4

1 回答 1

6

看起来“ICS”mime 类型被声明了两次。如果你能找到一个它被声明的实例,也许config/initializers/mime_types.rb你可以像这样添加一个除非子句:

Mime::Type.register "text/calendar", :ics unless Mime::Type.lookup_by_extension(:ics)

如果 mime 类型尚不存在,则只应注册它。

于 2012-01-29T00:48:12.673 回答