当前位置:  开发笔记 > 编程语言 > 正文

RoR:rake db:schema:加载RAILS_ENV =生产错误

如何解决《RoR:rakedb:schema:加载RAILS_ENV=生产错误》经验,为你挑选了1个好方法。

当我尝试在Rails中创建生产数据库时,我收到以下错误:

>rake db:schema:load RAILS_ENV=production --trace
rake db:schema:load RAILS_ENV=production --trace
(in C:/Users/user/Documents/Aptana Studio/truping)
** Invoke db:schema:load (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
no such file to load -- application
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:155:in `require'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:262:in `require_or_load'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:221:in `depend_on'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:133:in `require_dependency'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:18:in `define_dispatcher_callbacks'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:182:in `call'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:182:in `evaluate_method'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:166:in `call'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:90:in `run'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:90:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:90:in `send'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:90:in `run'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:277:in `run_callbacks'
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:559:in `send'
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:559:in `prepare_dispatcher'
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:173:in `process'
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in `send'
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in `run'
C:/Users/rrevi/Documents/Aptana Studio/truping/config/environment.rb:13
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/misc.rake:3
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `execute'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `execute'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in `invoke_with_call_chain'
C:/ruby/lib/ruby/1.8/monitor.rb:238:in `synchronize'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in `invoke_with_call_chain'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:588:in `invoke_prerequisites'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:585:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:585:in `invoke_prerequisites'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:577:in `invoke_with_call_chain'
C:/ruby/lib/ruby/1.8/monitor.rb:238:in `synchronize'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in `invoke_with_call_chain'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in `invoke'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in `invoke_task'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `top_level'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `top_level'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in `standard_exception_handling'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in `top_level'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in `run'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in `standard_exception_handling'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in `run'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:31
C:/ruby/bin/rake:19:in `load'
C:/ruby/bin/rake:19

有人可以帮忙吗?我错过了宝石吗?



1> Neeraj Singh..:

我认为您将Rails 2.2应用程序迁移到Rails 2.3.我在某个时候遇到过这个问题,但当我把application_controller.rb的副本作为application.rb时,它已经解决了.不确定真正的解决方案是什么,但它会让你的应用程序工作.


我同意这是问题 - 你的config/environments/production.rb有没有机会在里面有一个不同的RAILS_VERSION声明?从错误中看,你几乎看起来已经从Rails 2.3倒退到Rails 2.2 - 你可能有一个application_controller.rb,但系统需要application.rb.
推荐阅读
linjiabin43
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有