我有一個rails應用程序,它不會將數據加載到數據庫rake db:seed
上。rake db:rails中的種子錯誤4.0.0.rc1
我試圖找出由rake db:seed RAILS_ENV=developement --trace
它提供了以下錯誤
**調用數據庫:種子(FIRST_TIME)
**執行DB:種子
**調用數據庫:abort_if_pending_migrations(first_time)
**調用環境(first_time)
**執行環境
rake中止!
數據庫配置不指定適配器
/Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/connection_specification。 rb:52:
resolve_hash_connection' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/connection_specification.rb:46:in
resolve_string_connection' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/connection_specification.rb:30:在spec' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0.rc1/lib/active_record/connection_handling.rb:39:in
establish_connection ' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0.rc1/lib/active_record/railtie.rb:170:inblock (2 levels) in <class:Railtie>' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0.rc1/lib/active_support/lazy_load_hooks.rb:38:in
instance_eval的' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0.rc1/lib/active_support/lazy_load_hooks.rb:38:inexecute_hook' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0.rc1/lib/active_support/lazy_load_hooks.rb:28:in
block on_load' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0.rc1/lib/active_support/lazy_load_hooks.rb:27:each' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0.rc1/lib/active_support/lazy_load_hooks.rb:27:in
on_load' /Users/MacBook/.rvm/gems /ruby-2.0.0-p195/gems/activerecord-4.0.0.rc1/lib/active_record/railtie.rb:168:inblock in <class:Railtie>' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0.rc1/lib/rails/initializable.rb:30:in
instance_exec' /Users/MacBook/.rvm/gems/ruby-2.0.0 -p195/gems/railties-4.0.0.rc1/lib/rails/initializable.rb:30:在run' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0.rc1/lib/rails/initializable.rb:55:in
block in run_initializers' /Users/MacBook/.rvm/rubies/ruby-2.0.0-p195/lib /ruby/2.0.0/tsort.rb:150:inblock in tsort_each' /Users/MacBook/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/tsort.rb:183:in
each_strongly_connected_component中的塊(2級)' /Users/MacBook/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/tsort.rb:219:ineach_strongly_connected_component_from' /Users/MacBook/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/tsort.rb:182:in
block in each_strongly_connected_component' /Users/MacBook/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/tsort.rb:180:ineach' /Users/MacBook/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/tsort.rb:180:in
each_strongly_connected_component' /Users/MacBook/.rvm/rubies/ruby -2.0.0-p195/lib/ruby/2.0.0/tsort.rb:148:在tsort_each' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0.rc1/lib/rails/initializable.rb:54:in
run_initializers' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0 .0.rc1/lib/rails/application.rb:214:initialize!' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0.rc1/lib/rails/railtie/configurable.rb:30:in
method_missing' /Users/MacBook/rails_projects/medicaldevicehub/config/environment.rb:5:in<top (required)>' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0.rc1/lib/active_support/dependencies.rb:228:in
需要 ' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0.rc1/lib/active_support/dependencies.rb:228:inblock in require' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0.rc1/lib/active_support/dependencies.rb:213:in
load_dependency' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0.rc1/lib/active_support/dependencies.rb:228:require' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0.rc1/lib/rails/application.rb:188:in
require_environment!' /用戶/ MacBook /。rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0.rc1/lib/rails/application.rb:248:在block in run_tasks_blocks' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/task.rb:246:in
調用' /Users/MacBook/.rvm/gems/ruby- [email protected]/gems/rake-10.0.4/lib/rake/task.rb:246:在block in execute' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/task.rb:241:in
每個' /Users/MacBook/.rvm/gems/[email protected] global/gems/rake-10.0.4/lib/rake/task.rb:241:execute' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/task.rb:184:in
block in invoke_with_call_chain' /Users/MacBook/.rvm/rubies-2.0.0-p195/lib/ruby/ 2.0.0/monitor.rb:211:mon_synchronize' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/task.rb:177:in
invoke_with_call_chain' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/task。 rb:205:block in invoke_prerequisites' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/task.rb:203:in
每個' /Users/MacBook/.rvm/gems/ruby-2。 [email protected]/gems/rake-10.0.4/lib/rake/task.rb:203:invoke_prerequisites' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/task.rb:183:in
block in invoke_with_call_chain' /Users/MacBook/.rvm/rubies/ruby-2.0.0-p195/ lib/ruby/2.0.0/monitor.rb:211:mon_synchronize' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/task.rb:177:in
invoke_with_call_chain' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/ rake/task.rb:170:invoke' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0.rc1/lib/active_record/railties/databases.rake:180:in
塊(2級)' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake /task.rb:246:incall' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/task.rb:246:in
塊中執行」 /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/task.rb :241:在each' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/task.rb:241:in
執行' /Users/MacBook/.rvm/gems/ruby-2 .0.0-p195 @ global/gems/rake-10.0.4/lib/rake/task.rb:184:inblock in invoke_with_call_chain' /Users/MacBook/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in
mon_synchronize' /Users/MacBook/.rvm/gems/[email protected] /gems/rake-10.0.4/lib/rake/task.rb:177:ininvoke_with_call_chain' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/task.rb:170:in
invoke' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0 .4/lib/rake/application.rb:143:invoke_task' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/application.rb:101:in
top_level中的塊(2級)' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0 .4/lib/rake/application.rb:101:each' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/application.rb:101:in
block in top_level' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib /rake/application.rb:110:inrun_with_threads' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/application.rb:95:in
top_level' /Users/MacBook /.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/application.rb:73:在block in run' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/lib/rake/application.rb:160:in
standard_exception_handling' /Users/MacBook/.rvm/gems /[email protected]/gems/rake-10.0.4/lib/rake/application.rb:70:inrun' /Users/MacBook/.rvm/gems/[email protected]/gems/rake-10.0.4/bin/rake:33:in
' /Users/MacBook/.rvm/gems/ruby-2.0.0- p195 @ global/bin/rake:23:load' /Users/MacBook/.rvm/gems/[email protected]/bin/rake:23:in
' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:ineval' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in
'任務:TOP => db:abort_if_pending_migrations =>環境
這是我的database.yml file:
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
錯誤消息說你有未決的遷移:「調用數據庫:abort_if_pending_migrations」 – fengd
遷移後,我仍然有這個問題。 –
嘗試'rake db:seed development' –