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:in
send' from /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:in
load' 开发者_如何学C from /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:in
new_constants_in' from /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:in
require_or_load' from /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:in
const_missing' from /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:in
const_missing' from (irb):8
It should be User.create(:name...
(with a colon before name
), not User.create(name...
精彩评论