【发布时间】:2011-07-05 08:42:26
【问题描述】:
我正在尝试在第 7 章的 Rails 教程中测试在 sqlite3 db 中插入一行。我已经检查了很多次代码,它看起来是正确的,但是在控制台中我得到了以下错误。有什么建议?
User.create(name=>"test user",:email=>"testuser@example.com",:password=>"foobar",:password_confirmation=>"foobar") ArgumentError:参数数量错误(0 代表 1) 来自 /Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/base.rb:442:in
maximum' from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/base.rb:442:insend' 来自 /Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/base.rb:442:inmaximum' from /Users/gabemcmillan/rails_projects/sample_app/app/models/user.rb:10 from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:454:inload' 来自 /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:454:inload_file' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:innew_constants_in' 来自 /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:453:inload_file' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:340:inrequire_or_load' 来自 /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:491:inload_missing_constant' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:183:inconst_missing' 来自 /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:181:ineach' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:181:inconst_missing' 来自 (irb):8
【问题讨论】:
标签: ruby-on-rails