I have a "categories" table built using acts_as_tree and a "documents"
table that belongs to a specific category. Each category is a child of
a "root" category and I'd like to get *all* of the documents belonging
to the categories of a root category. Here's what the structure looks
like:
categories_table:
# using acts_as_tree
# has_many :documents
id,
parent_id,
name
documents_table:
# belongs_to :category
id,
category_id,
name
I know to get the documents for a specific category I can just do
category.documents. But I'd like to find all of the documents if I
visit 'Root 1' or 'Root 2' which means it'll find the documents
belonging to the categories in Root 1 that belong to Root 1.