开发者

ArgumentError: wrong number of arguments (0 for 1)

I am trying to test insert a row into sqlite3 db, for the Rails Tutorial in Chapter 7. I have gone over the code many times and it looks correct, however in the console I am getting the following error. Any suggestions?

User.create(name=>"test user",:email=>"testuser@example.com",:password=>"foobar",:password_confirmation=>"foobar") ArgumentError: wrong number of arguments (0 for 1) from /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' from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/base.rb:442:in maximum' 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' 开发者_如何学C from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:454:in load_file' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:innew_constants_in' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:453:in load_file' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:340:inrequire_or_load' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:491:in load_missing_constant' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:183:inconst_missing' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:181:in each' from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:181:inconst_missing' from (irb):8


It should be User.create(:name... (with a colon before name), not User.create(name...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜