ubuntu, ror, jQuery, css, website memo
太嫩, 沒啥心得, 用來紀錄每天學的
2008年12月17日 星期三
rails2.2 extra, dynamic finder
Rails2.2 release note
railscast rails2.2 extra
javaeye rails 2.2 release note
5.4 New Dynamic Finders
>> User.find(123)
ActiveRecord::RecordNotFound: Couldn't find User with ID=123
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1528:in `find_one'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1511:in `find_from_ids'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:590:in `find'
from (irb):1
>> User.find_by_id(123)
=> nil
#Rails 2.2 多了下面這個
>> User.find_by_id!(123)
ActiveRecord::RecordNotFound: ActiveRecord::RecordNotFound
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1814:in `find_by_id!'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1800:in `send'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1800:in `method_missing'
from (irb):3
>>
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言