【发布时间】:2015-01-14 07:15:08
【问题描述】:
我最近安装了Koudoku gem,它在我的计算机上运行良好,但是当我现在推送到 heroku 时,应用程序出现错误,日志如下所示。有谁知道为什么我收到有关 application_helper 的错误?我的项目中通常没有那个特定的文件,但我相信 Koudoku 引擎会在运行时添加它。感谢您的帮助!
编辑:我没有答案,但我怀疑这可能是由于引擎的初始化方式。我在 config/application.rb 文件中设置了以下行: config.assets.initialize_on_precompile = false 我认为这可能会阻止初始化程序加载,除非我根据这篇博文向我的 lib/engine.rb 添加一些内容: http://octothought.com/precompiling-assets-for-a-rails-engine-on-heroku/
谁能帮助我了解如何根据我的情况调整他们添加到 engine.rb 的代码?他们说:“神奇的咒语是将一个特殊的 :group => :assets 或 :group => :all 选项传递给引擎的初始化程序,并确保在该初始化程序中配置预编译。”但是在实际代码中,他们谈论的火箭发动机让我感到困惑。
initializer "RocketEngine asset precompile", :group => :all do |app|
app.config.assets.precompile += %w(
rocket.css
rocket.js
)
end
这是我在 heroku 上的实际错误:
heroku[web.1]: State changed from crashed to starting
heroku[web.1]: Starting process with command `bin/rails server -p 54469 -e production`
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/actionpack-4.2.0.beta2/lib/abstract_controller/helpers.rb:144:in `modules_for_helpers'
app[web.1]: => Booting WEBrick
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/bundler/gems/koudoku-9e73e64e5520/app/controllers/koudoku/application_controller.rb:4:in `<class:ApplicationController>'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta2/lib/rails/engine.rb:465:in `each'
app[web.1]: from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
app[web.1]: from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:308:in `depend_on'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta2/lib/rails/engine.rb:467:in `block in eager_load!'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.6.0/lib/rack/server.rb:208:in `app'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:80:in `block in server'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:75:in `tap'
app[web.1]: from bin/rails:8:in `<main>'
app[web.1]: Exiting
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/actionpack-4.2.0.beta2/lib/abstract_controller/helpers.rb:148:in `block in modules_for_helpers'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `require'
app[web.1]: from /app/config.ru:3:in `block in <main>'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
app[web.1]: from bin/rails:8:in `require'
app[web.1]: => Run `rails server -h` for more startup options
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/actionpack-4.2.0.beta2/lib/abstract_controller/helpers.rb:108:in `helper'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:349:in `require_or_load'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta2/lib/rails/engine.rb:465:in `eager_load!'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta2/lib/rails/application/finisher.rb:56:in `each'
app[web.1]: from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.6.0/lib/rack/builder.rb:49:in `eval'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.6.0/lib/rack/server.rb:336:in `wrapped_app'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/server.rb:80:in `start'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands.rb:17:in `<top (required)>'
app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/actionpack-4.2.0.beta2/lib/abstract_controller/helpers.rb:151:in `rescue in block in modules_for_helpers': Missing helper file helpers/application_helper.rb (AbstractController::Helpers::MissingHelperError)
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/actionpack-4.2.0.beta2/lib/action_controller/metal/helpers.rb:93:in `modules_for_helpers'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.beta2/lib/rails/initializable.rb:30:in `run'
app[web.1]: from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `block in require'
【问题讨论】:
标签: ruby-on-rails heroku