我正在阅读 Michael Hartl 的 Rails 教程,特别是第 6 章:
http://ruby.railstutorial.org/chapters/modeling-and-viewing-users-one#sec:finding_user_objects
在 user.destroy 命令之后执行 User.find(1) 后,我收到以下错误消息:
ruby-1.9.2-p290 :006 > User.find(1)
ActiveRecord::RecordNotFound: Couldn't find User with ID=1
from /Users/me/.rvm/gems/ruby-1.9.2-p290@rails3/gems/activerecord-3.0.9/lib/active_record/relation/finder_methods.rb:304:in `find_one'
from /Users/me/.rvm/gems/ruby-1.9.2-p290@rails3/gems/activerecord-3.0.9/lib/active_record/relation/finder_methods.rb:289:in `find_with_ids'
from /Users/me/.rvm/gems/ruby-1.9.2-p290@rails3/gems/activerecord-3.0.9/lib/active_record/relation/finder_methods.rb:107:in `find'
from /Users/me/.rvm/gems/ruby-1.9.2-p290@rails3/gems/activerecord-3.0.9/lib/active_record/base.rb:444:in `find'
from (irb):6
from /Users/me/.rvm/gems/ruby-1.9.2-p290@rails3/gems/railties-3.0.9/lib/rails/commands/console.rb:44:in `start'
from /Users/me/.rvm/gems/ruby-1.9.2-p290@rails3/gems/railties-3.0.9/lib/rails/commands/console.rb:8:in `start'
from /Users/me/.rvm/gems/ruby-1.9.2-p290@rails3/gems/railties-3.0.9/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
我一般是编程新手,我不知道从哪里开始。谷歌搜索错误消息并没有发现任何有用的信息。一切看起来都很好,我只是不知道为什么我除了异常之外还收到错误消息。