title: Nested resources and pretty urls
body: <p>I have 2 models:</p>
  
  <ol>
  <li>Sport</li>
  <li>Competition</li>
  </ol>
  
  <p>In my routes.rb I would normally do </p>
  
  <pre><code>resources :sports, :only =&gt; [:index, :show] do
    resources :competitions, , :only =&gt; [:index, :show]
  end
  </code></pre>
  
  <p>This gives me urls like <code>/sports/1/competitions/4</code></p>
  
  <p>But what I want is <strong>NOT</strong> <code>:controller/:id</code>, but directly the <code>:name</code> as path, like so <code>/soccer/euro2012</code></p>
  
  <p>I can get the first part by doing this:</p>
  
  <pre><code>match "/:sports_name" =&gt; "sports#show", :as =&gt; :sport
  </code></pre>
  
  <p>And in my controller:</p>
  
  <pre><code>def show
    @sport = Sport.find_by_name(params[:sports_name])
  end
  </code></pre>
  
  <p>But that's about it. I have no idea how to get the nested resource, or if I am doing something fundamentally wrong.</p>