在Rails开发中找不到资产404

时间:2013-06-09 00:02:04

标签: ruby-on-rails asset-pipeline

我不确定我何时第一次收到此消息,但错误消息仅出现在我的开发服务器上。生产heroku服务器不会报告任何内容。

Started GET "/assets/bootstrap_and_overrides.css?body=1" for 127.0.0.1 at 2013-06-08 16:57:30 -0700
Served asset /bootstrap_and_overrides.css - 304 Not Modified (0ms)


Started GET "/assets/" for 127.0.0.1 at 2013-06-08 16:57:30 -0700
Served asset / - 404 Not Found (5ms)

ActionController::RoutingError (No route matches [GET] "/assets"):
  actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
  railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
  activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
  railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.13) 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.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.5) lib/rack/lock.rb:15:in `call'
  railties (3.2.13) lib/rails/engine.rb:479:in `call'
  railties (3.2.13) lib/rails/application.rb:223:in `call'
  rack (1.4.5) lib/rack/content_length.rb:14:in `call'
  railties (3.2.13) lib/rails/rack/log_tailer.rb:17:in `call'
  thin (1.5.1) lib/thin/connection.rb:81:in `block in pre_process'
  thin (1.5.1) lib/thin/connection.rb:79:in `catch'
  thin (1.5.1) lib/thin/connection.rb:79:in `pre_process'
  thin (1.5.1) lib/thin/connection.rb:54:in `process'
  thin (1.5.1) lib/thin/connection.rb:39:in `receive_data'
  eventmachine (1.0.3) lib/eventmachine.rb:187:in `run_machine'
  eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
  thin (1.5.1) lib/thin/backends/base.rb:63:in `start'
  thin (1.5.1) lib/thin/server.rb:159:in `start'
  rack (1.4.5) lib/rack/handler/thin.rb:13:in `run'
  rack (1.4.5) lib/rack/server.rb:268:in `start'
  railties (3.2.13) lib/rails/commands/server.rb:70:in `start'
  railties (3.2.13) lib/rails/commands.rb:55:in `block in <top (required)>'
  railties (3.2.13) lib/rails/commands.rb:50:in `tap'
  railties (3.2.13) lib/rails/commands.rb:50:in `<top (required)>'
  script/rails:6:in `require'
  script/rails:6:in `<main>'

1 个答案:

答案 0 :(得分:0)

不确定为什么要尝试读取assets目录。但是你在dev服务器上没有看到/ assets的原因是rails会以dev模式为/ app / assets / stylesheets提供资源,对于存在的项目,但是因为没有到/ assets的路由(通过{检查) {1}})您收到错误。

在生产中rake routes在上传到heroku期间执行,因此创建并填充了dir / public / assets。

你可以在你的开发机器上rake assets:precompile看看会发生什么。