2011-10-11 4 views
4

이것을 좀 더 간결하게 작성하는 방법은 무엇입니까?ActiveRecord 개체가 쿼리에 있습니까?

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

레일에는 다음과 같은 것이 있습니까?

current_user.products.has? product 

내가 할 수있는 거 알아 :

current_user.products.include? product 

...하지만 모든 제품을로드합니다. 나는 그것에서 똑똑한 질문을 얻으려고 노력하고있다.

답변

관련 문제