我经常采取“旧”铁轨项目
我运行bundle install
并使用json 1.8.0反对我,然后使用bundle update
和bundle install
然后运行rake db:schema:load
当我运行rake db:seed
时会出错:
ArgumentError:参数数量错误(给定1,预期为0)
我发现所有的seed.rb行并且只放了一个创建并且失败了同样的错误
同时打开控制台(rails控制台)并尝试使用不同型号创建两个
irb(main):002:0> Group.create( name: "Test" )
(0.5ms) BEGIN
(0.2ms) ROLLBACK
ArgumentError: wrong number of arguments (given 1, expected 0)
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `initialize'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `new'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `substitute_at'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/relation.rb:99:in `block in substitute_values'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/relation.rb:98:in `each'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/relation.rb:98:in `each_with_index'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/relation.rb:98:in `substitute_values'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/relation.rb:58:in `insert'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/persistence.rb:521:in `_create_record'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/counter_cache.rb:139:in `_create_record'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/attribute_methods/dirty.rb:122:in `_create_record'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/callbacks.rb:306:in `block in _create_record'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.0.beta2/lib/active_support/callbacks.rb:83:in `run_callbacks'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/callbacks.rb:306:in `_create_record'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/timestamp.rb:57:in `_create_record'
from /var/lib/gems/2.3.0/gems/activerecord-4.2.0.beta2/lib/active_record/persistence.rb:501:in `create_or_update'
... 23 levels...
from /var/lib/gems/2.3.0/gems/railties-4.2.0.beta2/lib/rails/commands/console.rb:9:in `start'
from /var/lib/gems/2.3.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:68:in `console'
from /var/lib/gems/2.3.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /var/lib/gems/2.3.0/gems/railties-4.2.0.beta2/lib/rails/commands.rb:17:in `<top (required)>'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `require'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `block in require'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:233:in `load_dependency'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `require'
from /home/inye/Escritorio/zembia/aiurveda/bin/rails:8:in `<top (required)>'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:242:in `load'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:242:in `block in load'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:233:in `load_dependency'
from /var/lib/gems/2.3.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:242:in `load'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
答案 0 :(得分:1)
根据@max评论的解决方案是:
从gem 'rails', '4.2.0.beta2'
到gem 'rails', '4.2.7'
bundle update rails
问题解决了!