我正在使用我的rails环境设置我的新Macbook(Lion OSX)并遇到一个奇怪的问题,我无法弄清楚问题是什么。
当我运行rake db:setup或rake db:migrate时,我收到以下错误:
rake aborted!
wrong number of arguments (1 for 0)
Tasks: TOP => db:migrate => environment
当我运行跟踪时,我得到以下内容:
$/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/factory_girl-2.1.2/lib/factory_girl/syntax/default.rb:6:in `define'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/factory_girl-2.1.2/lib/factory_girl/deprecated.rb:5:in `method_missing'
/Users/djforth/Websites/bdglobal/spec/factories/sites.rb:3:in `<top (required)>'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `block in load'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/factory_girl-2.1.2/lib/factory_girl/find_definitions.rb:20:in `block (2 levels) in find_definitions'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/factory_girl-2.1.2/lib/factory_girl/find_definitions.rb:19:in `each'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/factory_girl-2.1.2/lib/factory_girl/find_definitions.rb:19:in `block in find_definitions'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/factory_girl-2.1.2/lib/factory_girl/find_definitions.rb:15:in `each'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/factory_girl-2.1.2/lib/factory_girl/find_definitions.rb:15:in `find_definitions'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/factory_girl_rails-1.2.0/lib/factory_girl_rails/railtie.rb:12:in `block in <class:Railtie>'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/lazy_load_hooks.rb:34:in `call'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/lazy_load_hooks.rb:42:in `each'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `instance_exec'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `run'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.0/lib/rails/initializable.rb:50:in `block in run_initializers'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `each'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `run_initializers'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.0/lib/rails/application.rb:92:in `initialize!'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/djforth/Websites/bdglobal/config/environment.rb:5:in `<top (required)>'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.0/lib/rails/application.rb:78:in `require_environment!'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.0/lib/rails/application.rb:189:in `block (2 levels) in initialize_tasks'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/djforth/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/Users/djforth/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/bin/rake:19:in `load'
/Users/djforth/.rvm/gems/ruby-1.9.2-head/bin/rake:19:in `<main>'
如果我卸载0.9.2并运行一个运行rake 0.8.7的旧项目,则rake工作正常。所以我认为这是耙子的问题,但不完全确定?
有人有任何想法吗?
答案 0 :(得分:1)
问题似乎在于:
/Users/djforth/Websites/bdglobal/spec/factories/sites.rb:3:in `<top (required)>'
你错误地宣布了一家工厂,而且可能没有检查0.8.7。