我有一个不会将数据加载到数据库的 Rails 应用程序rake db:seed
。
rake db:seed RAILS_ENV=developement --trace
我试图通过它找出以下错误
** 调用 db:seed (first_time)
** 执行数据库:种子
** 调用 db:abort_if_pending_migrations (first_time)
** 调用环境(first_time)
** 执行环境
耙中止!
数据库配置未指定适配器
/Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/connection_specification.rb:52:in
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:inspec' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0.rc1/lib/active_record/connection_handling.rb:39:in
建立连接'/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 in 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:ineach' /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:inrun' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0.rc1/lib/rails/initializable.rb:55: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
块(2 级)在 each_strongly_connected_component' /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' /用户/MacBook/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/tsort.rb:148:intsort_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:ininitialize!' /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:inrequire' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0.rc1/lib/rails/application.rb:188:in
require_environment!' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0.rc1/lib/rails/application.rb:248:inblock in run_tasks_blocks' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/task.rb:246:in
call' /Users/MacBook/.rvm/gems /ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/task.rb:246:inblock in execute' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/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:241:inexecute' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/task.rb:184:in
块 in invoke_with_call_chain' /Users/MacBook/ .rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:inmon_synchronize' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/task.rb:177:in
invoke_with_call_chain' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/ gems/rake-10.0.4/lib/rake/task.rb:205:inblock in invoke_prerequisites' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/task.rb:203:in
each' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib /rake/task.rb:203:ininvoke_prerequisites' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/task.rb:183:in
块 ininvoke_with_call_chain' /Users/MacBook/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:inmon_synchronize' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/task.rb:177:in
invoke_with_call_chain' /用户/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/task.rb:170:ininvoke' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0.rc1/lib/active_record/railties/databases.rake:180:in
'/Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/task.rb:246:incall' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/task.rb:246:in
block in execute'中的块(2级) /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/task.rb:241:each' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/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/ruby-2.0.0-p195@ global/gems/rake-10.0.4/lib/rake/task.rb:177:ininvoke_with_call_chain' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/task.rb:170:in
invoke' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4 /lib/rake/application.rb:143:ininvoke_task' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:101:in
block (2 levels) in top_level' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/耙子/application.rb:101:ineach' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:101:in
阻止顶层' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:110:inrun_with_threads' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:95:in
top_level' /Users/MacBook/ .rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:73:inblock in run' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:160:in
standard_exception_handling'/Users/MacBook/.rvm/gems/ruby-2.0。 0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:70:inrun' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/bin/rake:33:in
'/Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/bin/rake: 23:inload' /Users/MacBook/.rvm/gems/ruby-2.0.0-p195@global/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文件:
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