アプリケーションにデータをレーキしようとすると、このエラーが発生します。
次のようなJSONファイルがあります…</p>
[{"code": "OCH", "name": "blah", "location": "Texas, United States"},…
私のdb:seedsは次のようになります:
Airport.delete_all
airport_codes = JSON.parse(File.read(Rails.root.join('db/airport_codes.json')))
airport_codes.each do |code|
Airport.create!(code)
end
そして私のスタックトレース:
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@swlv/gems/mongoid-3.0.16/lib/mongoid/railties/database.rake:13:in `block (2 levels) in <top (required)>'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/task.rb:228:in `call'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/task.rb:228:in `block in execute'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/task.rb:223:in `each'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/task.rb:223:in `execute'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/Users/nicholasshook/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/task.rb:152:in `invoke'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/application.rb:143:in `invoke_task'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/application.rb:101:in `each'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/application.rb:101:in `block in top_level'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/application.rb:110:in `run_with_threads'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/application.rb:95:in `top_level'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/application.rb:73:in `block in run'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/bin/rake:19:in `load'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@global/bin/rake:19:in `<main>'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@swlv/bin/ruby_noexec_wrapper:14:in `eval'
/Users/nicholasshook/.rvm/gems/ruby-1.9.3-p194@swlv/bin/ruby_noexec_wrapper:14:in `<main>'
ありがとう!