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
Category 1 # contains documents
Category 2 # contains documents
Category 3 # contains documents
Category 4 # contains documents
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.
Can someone help?