title: rails 4 route matching order
body: <pre><code># Individual Page
  get '/manage/:type', to: 'manage#profile', as: :profile
  
  # Detail Page
  get '/manage/:id', to: 'manage#detail', as: :detail
  </code></pre>
  
  <p>In the code above, even if I create a url such as </p>
  
  <pre><code>&lt;%= link_to "Detail Page", detail_url(:id =&gt; 2) %&gt;
  </code></pre>
  
  <p>it still goes to profile action of the manage controller (even though it asks for <strong>type</strong> and not <strong>id</strong>).</p>
  
  <p>Is this expected behavior in rails 4.1, or am I doing something wrong?</p>
  
  <p>I thought that, if I have a named route, I can pass the appropriate parameters (:id => 2), and have it skip past the first route, simply because it does not match the route name.</p>
  
  <p><strong>Of course, things work as intended, if I reverse the order, and put "Detail" route before the profile route.</strong></p>