Created
September 8, 2010 03:49
-
-
Save liwh/569586 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> New.find(1) | |
ActiveRecord::RecordNotFound: Couldn't find New with ID=1 | |
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:1591:in `find_one' | |
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:1574:in `find_from_ids' | |
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:616:in `find' | |
from (irb):4 | |
>> New.find_by_id(1) | |
=> nil | |
//直接利用find方式查找,如果没有数据会跑出异常,而利用find_by_id方式会返回nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment