简体   繁体   English

Rails 3中字体超赞的资源出现路由错误

[英]Routing error with font-awesome assets in Rails 3

The font-awesome css file is located in app/assets/stylesheets/font-awesome.css and yet the error is: font-awesome css文件位于app/assets/stylesheets/font-awesome.css ,但错误是:

ActionController::RoutingError (No route matches [GET] "/assets/stylesheets/font-awesome.css"):
  actionpack (3.2.12) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.12) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.12) lib/rails/rack/logger.rb:32:in `call_app'
  railties (3.2.12) lib/rails/rack/logger.rb:16:in `block in call'
  activesupport (3.2.12) lib/active_support/tagged_logging.rb:22:in `tagged'
  railties (3.2.12) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.12) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.5) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.12) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.5) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.12) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.12) lib/rails/engine.rb:479:in `call'
  railties (3.2.12) lib/rails/application.rb:223:in `call'
  rack (1.4.5) lib/rack/content_length.rb:14:in `call'
  railties (3.2.12) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
  webrick (1.3.1) lib/webrick/httpserver.rb:138:in `service'
  webrick (1.3.1) lib/webrick/httpserver.rb:94:in `run'
  webrick (1.3.1) lib/webrick/server.rb:191:in `block in start_thread'

Based on another Github answer ( https://github.com/seyhunak/twitter-bootstrap-rails/issues/535 ), fontawesome-webfont.woff is located in vendor/assets/font but the error is: 基于另一个Github上的答案( https://github.com/seyhunak/twitter-bootstrap-rails/issues/535 ), fontawesome-webfont.woff位于vendor/assets/font ,但错误的是:

Started GET "/font/fontawesome-webfont.woff?v=3.2.1" for 127.0.0.1 at 2013-08-03 16:31:35 -0700 在2013-08-03 16:31:35 -0700开始为127.0.0.1获取``/font/fontawesome-webfont.woff?v=3.2.1''

ActionController::RoutingError (No route matches [GET] "/font/fontawesome-webfont.woff"):
  actionpack (3.2.12) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.12) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.12) lib/rails/rack/logger.rb:32:in `call_app'
  railties (3.2.12) lib/rails/rack/logger.rb:16:in `block in call'
  activesupport (3.2.12) lib/active_support/tagged_logging.rb:22:in `tagged'
  railties (3.2.12) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.12) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.5) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.12) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.5) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.12) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.12) lib/rails/engine.rb:479:in `call'
  railties (3.2.12) lib/rails/application.rb:223:in `call'
  rack (1.4.5) lib/rack/content_length.rb:14:in `call'
  railties (3.2.12) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
  webrick (1.3.1) lib/webrick/httpserver.rb:138:in `service'
  webrick (1.3.1) lib/webrick/httpserver.rb:94:in `run'
  webrick (1.3.1) lib/webrick/server.rb:191:in `block in start_thread'

I have tried pre-compiling the assets before running the app but that doesn't work either. 在运行应用程序之前,我曾尝试过预编译资产,但这也不起作用。 Any ideas would be much appreciated! 任何想法将不胜感激!

This is the general guide to using font-awesome with Rails. 这是在Rails中使用font-awesome的一般指南

However I usually just use this gem which does it for you. 但是我通常只使用为您做的这个宝石

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM