包含模块的Heroku App崩溃

时间:2011-03-22 05:45:50

标签: ruby-on-rails deployment module heroku

所以我在开发和生产环境中都在本地测试了我的应用程序,在推送到Heroku之前,一切似乎都运行正常。当我检查Heroku上的日志时,我得到以下内容:

    2011-03-21T22:37:42-07:00 heroku[slugc]: Slug compilation started
    2011-03-21T22:38:43-07:00 heroku[api]: Deploy f9bb672 by some.email@gmail.com
    2011-03-21T22:38:43-07:00 heroku[web.1]: State changed from created to starting
    2011-03-21T22:38:43-07:00 heroku[slugc]: Slug compilation finished
    2011-03-21T22:38:46-07:00 app[web.1]: /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/app/controllers/songs_controller.rb:2: uninitialized constant SongsController::Utils (NameError)
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:138:in `eager_load!'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:137:in `each'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:137:in `eager_load!'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:135:in `each'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:135:in `eager_load!'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:108:in `eager_load!'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application/finisher.rb:41
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `instance_exec'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `run'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:50:in `run_initializers'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `each'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `run_initializers'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:134:in `initialize!'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `send'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/config/environment.rb:5
    2011-03-21T22:38:46-07:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    2011-03-21T22:38:46-07:00 app[web.1]:   from config.ru:3
    2011-03-21T22:38:46-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:23
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:63:in `new'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:63:in `map'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:18
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:11:in `new'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:11
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:1:in `new'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:1
    2011-03-21T22:38:46-07:00 heroku[web.1]: State changed from starting to crashed
    2011-03-21T22:38:46-07:00 heroku[web.1]: State changed from crashed to created
    2011-03-21T22:38:47-07:00 heroku[web.1]: State changed from created to starting
    2011-03-21T22:38:49-07:00 app[web.1]: /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/app/controllers/songs_controller.rb:2: uninitialized constant SongsController::Utils (NameError)
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:138:in `eager_load!'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:137:in `each'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:137:in `eager_load!'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:135:in `each'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:135:in `eager_load!'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:108:in `eager_load!'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application/finisher.rb:41
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `instance_exec'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `run'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:50:in `run_initializers'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `each'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `run_initializers'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:134:in `initialize!'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `send'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/config/environment.rb:5
    2011-03-21T22:38:49-07:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    2011-03-21T22:38:49-07:00 app[web.1]:   from config.ru:3
    2011-03-21T22:38:49-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:23
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:63:in `new'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:63:in `map'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:18
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:11:in `new'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:11
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:1:in `new'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:1
    2011-03-21T22:38:50-07:00 heroku[web.1]: State changed from starting to crashed
    2011-03-21T22:39:00-07:00 heroku[rake.1]: State changed from created to starting
    2011-03-21T22:39:06-07:00 heroku[rake.1]: State changed from starting to complete
    2011-03-21T22:39:10-07:00 heroku[router]: Error H10 (App crashed) -> GET blazing-dawn-282.heroku.com/ dyno=none queue=0 wait=0ms service=0ms bytes=0
    2011-03-21T22:39:10-07:00 heroku[nginx]: GET / HTTP/1.1 | 173.51.104.168 | 796 | http | 503
    2011-03-21T22:39:10-07:00 heroku[router]: Error H10 (App crashed) -> GET blazing-dawn-282.heroku.com/favicon.ico dyno=none queue=0 wait=0ms service=0ms bytes=0
    2011-03-21T22:39:10-07:00 heroku[nginx]: GET /favicon.ico HTTP/1.1 | 173.51.104.168 | 795 | http | 503

我假设这是因为我试图在我的/ lib目录中包含一个名为Utils的模块。

在我的控制器中,我执行以下操作:

   include Utils

文件名是Utils.rb,模块的结构是:

    module Utils
        def some_function
        end
    end

不确定问题是什么,但我已采取以下步骤:

  • 将config.autoload_paths + =%W(#{config.root} / lib)添加到我的application.rb文件
  • 在我的production.rb文件中设置config.serve_static_assets = true,因为我的某些css和javascript没有正确发送
  • 确保运行heroku rake db:migrate
  • 确保我将最新版本从git推送到heroku

基本上我的想法已经用完了,我真的很想解决这个问题,任何帮助都会非常感激。谢谢!

1 个答案:

答案 0 :(得分:1)

请确保文件名为 utils.rb ,而不是 Utils.rb