Using active record, how can I return the results for a model if they do not exist in a certain relationship elsewhere. For example, say I have a Recipe
model which belongs to categories
(via a category_recipes
join table).
So basically I have a Rake task that looks through each recipe and it's description and try to put in in a category, but the task takes a long time and I'll need to run it on a regular basis, so I only want to run it if the Recipe
in question has not already been categorized and I'd rather not add a superfluous column like categorized
, so I figure there is a way to retrieve only the Recipes that don't exist in the join table. Any thoughts?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With