Rails/ActiveRecord Sub collection
- by Jake
I have three models: Store, Author, Books
Store has many Authors which has many Books.
What is the cleanest way to get a collection of all the books at the store?
This works:
@store.authors.collect{|a| a.books}.flatten
Is there something in Active Record that I'm missing that makes this cleaner?
Jake