what’s the most resource friendly way to program the following?
In the VIEW, I need to show a ‘nested :has_many’ structure like this:
I assume this means that:
- Author, Book, Chapter, Page must be “collections” (@authors, @books,
- I need to have a :partial for each collection
- Each :partial contains the next :partial (nested parent-child
- Doing (for example)Â the query for @books directly within the ‘author’
:partial (and so on) would be stupid, wouldn’t it…
- So how do I need to write the database queries in the controller (in
the most efficient way) for such a case?
- How would this look like in the view (how to access the values)? (for
example in any child :partial)
Thank you very much for your help!