title: I'm not sure I understand how best to create routes and their controllers. Help in this situation please
body: <p>It possibly is. I went through my models first pass, and then began to create the easy controllers. Now I'm starting to do the controllers that have nesting involved, and various different associations.</p>
  
  <p>I'll give it some context rather than a, b, c.</p>
  
  <p>World Cup app, with models as follows. Let's enter information for Argentina's upcoming match against Iran this Saturday.</p>
  
  <p>Stage (has_many matches)</p>
  
  <p>id|name|start_date|end_date</p>
  
  <p>1|Qualification Stage|Jun 01, 2011|November 31, 2013</p>
  
  <p>2|Group Stage|Jun 12, 2014|Jun 27, 2014</p>
  
  <p>3|Knockout Stage|Jun 28, 2014|Jul 13, 2014</p>
  
  <p>Player (belongs_to team)</p>
  
  <p>id|team_id|first_name|last_name|number</p>
  
  <p>1|1|Lionel|Messi|10</p>
  
  <p>Team (has_many players, has_many competitions, class_name: 'Competitor', has_many matches, through competitions)</p>
  
  <p>id|country|</p>
  
  <p>1|Argentina</p>
  
  <p>2|Iran</p>
  
  <p>Match (has_many competitors, has_many teams, through competitors, belongs_to stage)</p>
  
  <p>id|stage_id|start_date_at</p>
  
  <p>17|2|Jun 21, 2014</p>
  
  <p>Competitor (belongs_to match, belongs_to team)</p>
  
  <p>id|match_id|team_id|home</p>
  
  <p>33|17|1|false</p>
  
  <p>34|17|2|true</p>
  
  <p>The URL I reference above in my vague example is api/v1/players/1/matches. This URL, accessing #index, would list of all Lionel Messi's matches.</p>
  
  <p>However, let's say in our app someone clicks on Lionel Messi's profile, and we want to show Messi's matches for today.</p>
  
  <p>I want to pass in today's date as a filter somehow, and use it against ~player.team.matches.where('start_date_at = ?', DateTime.now.to_date). </p>
  
  <p><strong>a)</strong> What is the proper URL to do so? Do I just add this filtering ability to #index? By default if no filtering is added to the URL, then just return all of the players matches, but if it is (/api/v1/players/1/games?date="") then filter under the #index? What if I happen to only allow one filter, and can guarantee there is only ever going to be 1 match returned. Such as day and there is never more than 1 match per day. Does that belong under a #show, or #index, or am I missing the boat on both?</p>
  
  <p><strong>b)</strong> what if instead I want to also be able to filter a players matches based on stage. In this case, it has the potential to return more than 1 result. Let's say the user for whatever reason wants to go back and view all of Lionel Messi's Qualification games. player.team.games.where('stage_id = 1'). Do I just allow for all sorts of filtering under my #index?</p>
  
  <p><strong>c)</strong> one question I forgot to ask. Let's say we want to today's opponent only. Any Lionel Messi fan knows he plays for Argentina, so on his profile we just want something that say '@ Iran' for Jun 21, 2014. </p>
  
  <p>So Competitor holds 2 rows for every match_id. A home team and away team. If we do a player.find(:player_id).team.competitions we will receive back...</p>
  
  <p>id|match_id|team_id|home
  33|17|1|false</p>
  
  <p>It has returned us that we are the away team in match_id 17. What is the best way to get our opponent?</p>
  
  <p>I'm kind of thinking I should just iterate through player.find(:player_id).team.matches, and then use each and every match_id to get a list of both competitors for each match. And just return them all to the API, and the API can pull the opponent team from the data. Does that seem like the best way?</p>