Koudoku在本地运行良好但在Heroku上崩溃

时间:2015-01-13 15:11:59

标签: ruby-on-rails heroku

我最近安装了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 =>:引擎初始化程序的所有选项,并确保在初始化程序中配置预编译。”但是在实际的代码中,他们谈论的火箭引擎让我感到困惑。

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'

1 个答案:

答案 0 :(得分:0)

我通过将app_helper.rb添加到app / helpers来修复此问题:

module ApplicationHelper
end

还要在controllers / application_controller.rb中导入ApplicationHelper

class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception
  include ApplicationHelper
end