I have a basic Schema:
class Category < ActiveRecord::Base
has_many :subcategories, class_name: 'Category', foreign_key: 'parent_id', dependent: :destroy
belongs_to :parent_category, class_name: 'Category'
end
I want to get all Category objects that DO NOT have any subcategories.
How can I use ActiveRecord to get this result?