无法在生产服务器上通过rake路由查找表

时间:2013-05-15 04:52:22

标签: ruby-on-rails ruby-on-rails-3 routes rake

使用rake routes检查生产服务器上的路由时,会出现Could not find table 'authentify_engine_configs'错误,该错误是数据库中的表。什么可能导致此错误?以下是完整的跟踪:

cjadmin@ubuntu-ibm:/var/www/nbhyop/current$ bundle exec rake routes --trace
** Invoke routes (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Could not find table 'authentify_engine_configs'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/connection_adapters/sqlite_adapter.rb:472:in `table_structure'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/connection_adapters/sqlite_adapter.rb:346:in `columns'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/connection_adapters/schema_cache.rb:12:in `block in initialize'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/model_schema.rb:228:in `yield'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/model_schema.rb:228:in `default'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/model_schema.rb:228:in `columns'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/model_schema.rb:237:in `columns_hash'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/locking/optimistic.rb:129:in `locking_enabled?'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/relation.rb:170:in `exec_queries'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/relation.rb:160:in `block in to_a'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/explain.rb:33:in `logging_query_plan'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/relation.rb:159:in `to_a'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/relation/finder_methods.rb:378:in `find_first'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/relation/finder_methods.rb:122:in `first'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/bundler/gems/authentify-6d86f5486c71/app/custom/authentify/authentify_utility.rb:85:in `find_config_const'
/var/www/nbhyop/releases/20130514202149/config/initializers/my_constants.rb:7:in `<top (required)>'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `load'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `block in load'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `load'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/engine.rb:587:in `each'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/engine.rb:587:in `block in <class:Engine>'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/www/nbhyop/releases/20130514202149/config/environment.rb:6:in `<top (required)>'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/application.rb:103:in `require'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/application.rb:103:in `require_environment!'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/home/cjadmin/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:205:in `block in invoke_prerequisites'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:203:in `each'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:183:in `block in invoke_with_call_chain'
/home/cjadmin/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/bin/rake:23:in `load'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/bin/rake:23:in `<main>'
Tasks: TOP => routes => environment
cjadmin@ubuntu-ibm:/var/www/nbhyop/current$

这是使用nginx和乘客在ubuntu上运行的rails 3.2.12 app。 rake db:migrate有同样的错误。

感谢您的帮助。

1 个答案:

答案 0 :(得分:4)

如果它真的是生产,那么你需要告诉rails,否则它将默认使用开发

RAILS_ENV=production bundle exec rake routes