I have three models:
Channel > Program > Episode
Channel has_many programs
Program belongs_to channel
Program has_many episodes
Episode belongs_to program
How to make this query?
* "Number of total Episodes of associated Channel which has the highest number of Programs. *
To be more detailed,
- Find the Channel which has the highest number of programs.
- Find number of episodes joining with programs that belong to that Channel.
I'm really stucked.
How to do this most efficiently instead of writing lines of codes and many queries?