2011-10-11 45 views
4

是寫這篇的這種更簡潔的方式:是查詢中的ActiveRecord對象嗎?

current_user.products.where(:product_id => product.id).present? 

鐵軌是否有什麼樣的呢?

current_user.products.has? product 

我知道我可以做:

current_user.products.include? product 

...但加載的所有產品。我試圖從中得到一個聰明的查詢。

回答