2011-10-11 36 views
4

是写这篇的这种更简洁的方式:是查询中的ActiveRecord对象吗?

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

铁轨是否有什么样的呢?

current_user.products.has? product 

我知道我可以做:

current_user.products.include? product 

...但加载的所有产品。我试图从中得到一个聪明的查询。

回答