1

据我所知,我没有以任何形式或形式引用 favicon.ico,但我对 rails 服务器(处于开发模式)的每个请求都以以下内容结尾:

Started GET "/assets/ico/favicon.ico" for 127.0.0.1 at 2012-06-12 20:18:02 -0700
Served asset /ico/favicon.ico - 404 Not Found (3ms)

ActionController::RoutingError (No route matches [GET] "/assets/ico/favicon.ico"):
  actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.3) lib/rails/engine.rb:479:in `call'
  railties (3.2.3) lib/rails/application.rb:220:in `call'
  rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  railties (3.2.3) lib/rails/rack/log_tailer.rb:14:in `call'
  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  /Users/twler/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  /Users/twler/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  /Users/twler/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

这是与 webrick 相关的问题,还是我需要更改一些配置选项或什么?

编辑:我将 favicon.ico 放在 app/assets/ico/favicon.ico、lib/assets/ico/favicon.ico 和 public/favicon.ico 中。favicon 徽标甚至出现在我的浏览器中,但 rails 服务器仍然在日志中显示 404。有什么建议么?

4

2 回答 2

5

这不是 Rails——Web 浏览器会自动请求它。

于 2012-06-13T03:33:33.333 回答
1

浏览器会自动查找您网站的图标(您在地址栏和书签中的 URL 旁边看到的图标)。最简单的方法是创建一个 favicon 并将其保存到 /assets/ico/favicon.ico。

于 2012-06-13T03:35:52.123 回答