ubuntu, ror, jQuery, css, website memo
太嫩, 沒啥心得, 用來紀錄每天學的
2010年3月1日 星期一
Rails Code Review PDF
http://peepcode.com/products/rails-code-review-pdf
#:select and :include
#If a query contains an :include directive, any :select
options will be ignored. For example you might expect this
to return an array of ids only. Not so!
# This won't work as you expect
Farm.find(:all, {
:select => "farms.id, chickens.id",
:include => :chickens
})
#use :join with :select
The way around this is to code the :join explicitly.
Farm.find(:all, {
:select => "farms.id, chickens.id",
:join => "LEFT JOIN ..."
})
LEFT OUTER JOIN chickens ON chickens.farm_id =
farms.id
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言