Come on, we have a "Topic - Relationships - Category".
That is, the topic has_many categories through relationships.
I think itβs very easy to get topics that are with a category
#Relationship Model Topic_id: integer Category_id: integer @topics=Topic.joins(:relationships)
But not every topic has a category. So how do we get a topic that does not have a category? Is there a minus request?
Perhaps it looks like @topics=Topic.where('id NOT IN (?)', Relationship.all) I find it in activerecord equivalent to SQL 'minus' , but not sure about this solution.
source share