I have a Product and Creator table, I also have a table called CreatorProduct which joins the creator with the product. A product can have many creators and a creator can have many products. What I want to do is find the products that have creators, some products might not have creators.
I have written the code below but how do I write it in a more rails friendly way? This works for my in rails console but when I put it in my code I get undefined method `includes' for #
Product.find_by_sql("select * from Products where id in (select product_id from Creator_Products intersect select id from Products)")
Thanks!