补上 最后发现是 ruby 的版本太低,不支持 mongoid
运行以后的错误页面 运行 Shell 的截图
不能贴图了,只能放代码、@huacnlee
·ruby@Desert:~/ruby-china$ rake db:seed --trace
** Invoke db:seed (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:seed
rake aborted!
undefined method `[]' for nil:NilClass
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:74:in `block in command'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:522:in `[]'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:522:in `block (3 levels) in flush'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:521:in `map'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:521:in `block (2 levels) in flush'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:113:in `ensure_connected'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:517:in `block in flush'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:532:in `logging'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:516:in `flush'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:505:in `process'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:70:in `command'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/node.rb:356:in `refresh'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/cluster.rb:101:in `block in refresh'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/cluster.rb:114:in `each'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/cluster.rb:114:in `refresh'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/cluster.rb:67:in `nodes'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/cluster.rb:176:in `with_secondary'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/session/context.rb:104:in `with_node'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/session/context.rb:43:in `query'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/moped-1.1.2/lib/moped/query.rb:108:in `first'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/mongoid-3.0.1/lib/mongoid/contextual/mongo.rb:200:in `first'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/mongoid-3.0.1/lib/mongoid/contextual.rb:18:in `first'
/home/ruby/ruby-china/app/models/site_config.rb:48:in `find_by_key'
/home/ruby/ruby-china/app/models/site_config.rb:52:in `save_default'
/home/ruby/ruby-china/db/seeds.rb:7:in `<top (required)>'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:245:in `load'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:245:in `block in load'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:245:in `load'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/gems/mongoid-3.0.1/lib/mongoid/railties/database.rake:13:in `block (2 levels) in <top (required)>'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/ruby/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/bin/rake:19:in `load'
/home/ruby/.rvm/gems/ruby-1.9.2-p320@global/bin/rake:19:in `<main>'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `eval'
/home/ruby/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:seed
ruby@Desert:~/ruby-china$ ·