Ранее работающее приложение Rails 3.1 теперь не может быть развернуто.Задача Capistrano deploy:assets:precompile
обнаруживает ошибку "Could not find table 'users'
".
Я использовал rake --trace
, чтобы зафиксировать эту ошибку для вновь добавленной именованной области в модели users
:
scope :find_by_skill_offered, lambda { |skill_id|
joins(:skills).where("user_skills.offered = ? AND skills.id = ?", 'true', skill_id)
}
Мне кажется, что задача rake может пытаться выполнить лямбду, прежде чем база данных будет связана, и, следовательно, не сможет.
Это похоже на проблему эта проблема сfactory_girl , то есть код, выполняемый до того, как база данных существует, но я не могу понять, почему лямбда будет выполняться до того, как она будет фактически вызвана.
Трассировка стека показывает построение маршрутов Devise там какну, может быть, это связано с этим, но кажется странным, что код маршрутизации выполняется как часть deploy:assets:precompile
, или я что-то упускаю из-за того, как работает конвейер?
Заранее спасибо.
Обновление:
Это также происходит с локальным rake assets:precompile
(я обычно создаю ресурсы только на сервере).
Полный вывод ошибок и трассировка:
* 18:47:58 == Currently executing `deploy:assets:precompile'
* executing "cd /home/backscratchers/development/backscratchers/releases/20111010174747 && rake --trace RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
servers: ["87.106.100.151"]
[87.106.100.151] executing command
*** [err :: 87.106.100.151] ** Invoke assets:precompile (first_time)
*** [err :: 87.106.100.151] ** Execute assets:precompile
*** [err :: 87.106.100.151] ** Invoke environment (first_time)
*** [err :: 87.106.100.151] ** Execute environment
*** [err :: 87.106.100.151] rake aborted!
*** [err :: 87.106.100.151] Could not find table 'users'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/sqlite_adapter.rb:387:in `table_structure'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/sqlite_adapter.rb:270:in `columns'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `block (2 levels) in initialize'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:185:in `with_connection'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:92:in `block in initialize'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb:706:in `yield'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb:706:in `default'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb:706:in `columns'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb:722:in `column_names'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb:735:in `column_methods_hash'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb:1101:in `all_attributes_exists?'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb:886:in `respond_to?'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/named_scope.rb:193:in `valid_scope_name?'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/named_scope.rb:175:in `scope'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/releases/20111010174747/app/models/user.rb:6:in `<class:User>'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/releases/20111010174747/app/models/user.rb:1:in `<top (required)>'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in `load_dependency'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:348:in `require_or_load'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:489:in `load_missing_constant'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:181:in `block in const_missing'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:179:in `each'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:179:in `const_missing'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:124:in `block in constantize'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:123:in `each'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:123:in `constantize'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:528:in `block in initialize'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:550:in `yield'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:550:in `default'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:550:in `[]'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:595:in `constantize'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/devise-1.4.5/lib/devise.rb:259:in `get'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/devise-1.4.5/lib/devise/mapping.rb:101:in `to'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/devise-1.4.5/lib/devise/mapping.rb:96:in `modules'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/devise-1.4.5/lib/devise/mapping.rb:113:in `routes'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/devise-1.4.5/lib/devise/mapping.rb:82:in `initialize'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/devise-1.4.5/lib/devise.rb:289:in `new'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/devise-1.4.5/lib/devise.rb:289:in `add_mapping'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/devise-1.4.5/lib/devise/rails/routes.rb:191:in `block in devise_for'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/devise-1.4.5/lib/devise/rails/routes.rb:190:in `each'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/devise-1.4.5/lib/devise/rails/routes.rb:190:in `devise_for'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/releases/20111010174747/config/routes.rb:20:in `block in <top (required)>'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/actionpack-3.1.0/lib/action_dispatch/routing/route_set.rb:257:in `instance_exec'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/actionpack-3.1.0/lib/action_dispatch/routing/route_set.rb:257:in `eval_block'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/actionpack-3.1.0/lib/action_dispatch/routing/route_set.rb:234:in `draw'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/releases/20111010174747/config/routes.rb:1:in `<top (required)>'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `block in load'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in `load_dependency'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application/routes_reloader.rb:29:in `block in load_paths'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application/routes_reloader.rb:29:in `each'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application/routes_reloader.rb:29:in `load_paths'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application/routes_reloader.rb:13:in `reload!'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application/routes_reloader.rb:7:in `block in initialize'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/file_update_checker.rb:32:in `call'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application/finisher.rb:63:in `block (2 levels) in <module:Finisher>'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application/finisher.rb:64:in `call'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application/finisher.rb:64:in `block in <module:Finisher>'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `instance_exec'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `run'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/initializable.rb:50:in `block in run_initializers'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `each'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `run_initializers'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application.rb:92:in `initialize!'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/releases/20111010174747/config/environment.rb:5:in `<top (required)>'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application.rb:78:in `require_environment!'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application.rb:189:in `block (2 levels) in initialize_tasks'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
*** [err :: 87.106.100.151] /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
*** [err :: 87.106.100.151] /home/backscratchers/development/backscratchers/shared/bundle/ruby/1.9.1/gems/actionpack-3.1.0/lib/sprockets/assets.rake:11:in `block (2 levels) in <top (required)>'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
*** [err :: 87.106.100.151] /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
*** [err :: 87.106.100.151] /usr/local/rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'
*** [err :: 87.106.100.151] Tasks: TOP => environment