【发布时间】:2015-01-31 02:56:57
【问题描述】:
我的 Heroku 应用由于“缺少帮助文件 helpers/factory_girl.rb”而崩溃,即使它可以在本地运行并且FactoryGirl 仅安装在我的 Gemfile 测试组中。
- 为什么 Heroku 要求我的 FactoryGirl 助手在开发中不需要并且未指定为生产 gem?
-
helpers/factory_girl.rb应该是什么样子?我在网上搜索并找不到任何东西。一个完全空白的文件可以工作吗?
我正在运行 Rails 3.2.13、Ruby 2.0.0-p481 和 factory_girl_rails 4.4.1。
宝石文件:
group :test do
gem "factory_girl_rails", ">= 4.0"
end
Heroku 日志:
2015-01-31T02:16:01.071477+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:317:in `rescue in depend_on': Missing helper file helpers/factory_girl.rb (LoadError)
2015-01-31T02:16:01.071484+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:312:in `depend_on'
2015-01-31T02:16:01.071515+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/helpers.rb:135:in `block in modules_for_helpers'
2015-01-31T02:16:01.071524+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/helpers.rb:131:in `modules_for_helpers'
2015-01-31T02:16:01.071522+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/helpers.rb:131:in `map!'
2015-01-31T02:16:01.071487+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in `require_dependency'
2015-01-31T02:16:01.071526+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/helpers.rb:92:in `modules_for_helpers'
2015-01-31T02:16:01.071530+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/railties/paths.rb:18:in `block (2 levels) in with'
2015-01-31T02:16:01.071533+00:00 app[web.1]: from /app/app/controllers/application_controller.rb:4:in `<top (required)>'
2015-01-31T02:16:01.071535+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
2015-01-31T02:16:01.071537+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
2015-01-31T02:16:01.071528+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/helpers.rb:95:in `helper'
2015-01-31T02:16:01.071538+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
2015-01-31T02:16:01.071540+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
2015-01-31T02:16:01.071581+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
2015-01-31T02:16:01.071570+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:502:in `load_missing_constant'
2015-01-31T02:16:01.071572+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:192:in `block in const_missing'
2015-01-31T02:16:01.071574+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:190:in `each'
2015-01-31T02:16:01.071576+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:190:in `const_missing'
2015-01-31T02:16:01.071583+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_suppor
t/dependencies.rb:251:in `block in require'
2015-01-31T02:16:01.071578+00:00 app[web.1]: from /app/app/controllers/activations_controller.rb:1:in `<top (required)>'
2015-01-31T02:16:01.071550+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:359:in `require_or_load'
2015-01-31T02:16:01.071647+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:436:in `eager_load!'
2015-01-31T02:16:01.071633+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
2015-01-31T02:16:01.071622+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
2015-01-31T02:16:01.071625+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
2015-01-31T02:16:01.071627+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:359:in `require_or_load'
2015-01-31T02:16:01.071629+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:313:in `depend_on'
2015-01-31T02:16:01.071631+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in `require_dependency'
2015-01-31T02:16:01.071640+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:438:in `each'
2015-01-31T02:16:01.071642+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:438:in `block in eager_load!'
2015-01-31T02:16:01.071644+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:436:in `each'
2015-01-31T02:16:01.071648+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
2015-01-31T02:16:01.071654+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
2015-01-31T02:16:01.071650+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
2015-01-31T02:16:01.071652+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
2015-01-31T02:16:01.071656+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
2015-01-31T02:16:01.071658+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
2015-01-31T02:16:01.071659+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
2015-01-31T02:16:01.071661+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
2015-01-31T02:16:01.071688+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>'
2015-01-31T02:16:01.071690+00:00 app[web.1]: from /app/config.ru:3:in `require'
2015-01-31T02:16:01.071692+00:00 app[web.1]: from /app/config.ru:3:in `block in <main>'
2015-01-31T02:16:01.071693+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
2015-01-31T02:16:01.071695+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
2015-01-31T02:16:01.071698+00:00 app[web.1]: from /app/config.ru:1:in `new'
2015-01-31T02:16:01.071699+00:00 app[web.1]: from /app/config.ru:1:in `<main>'
2015-01-31T02:16:01.071701+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/lib/rack/adapter/loader.rb:33:in `eval'
2015-01-31T02:16:01.071703+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/lib/rack/adapter/loader.rb:33:in `load'
2015-01-31T02:16:01.071705+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/lib/rack/adapter/loader.rb:42:in `for'
2015-01-31T02:16:01.071707+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/lib/thin/controllers/controller.rb:170:in `load_adapter'
2015-01-31T02:16:01.071709+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/lib/thin/controllers/controller.rb:74:in `start'
2015-01-31T02:16:01.071711+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/lib/thin/runner.rb:199:in `run_command'
2015-01-31T02:16:01.071713+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/lib/thin/runner.rb:155:in `run!'
2015-01-31T02:16:01.071715+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.6.2/bin/thin:6:in `<top (required)>'
2015-01-31T02:16:01.071717+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/bin/thin:19:in `load'
2015-01-31T02:16:01.071719+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/bin/thin:19:in `<main>'
2015-01-31T02:16:01.971364+00:00 heroku[web.1]: Process exited with status 1
2015-01-31T02:16:01.976052+00:00 heroku[web.1]: State changed from starting to crashed
【问题讨论】:
-
helpers/factory_girl.rb上写的是什么路径和内容?路径是app/helpers/factory_girl.rb?还有,FactoryGirl.define do ... end?请与我们分享。
标签: ruby-on-rails ruby-on-rails-3 heroku factory-bot