title: Add directory to URL in Rails Routes
body: <p>For SEO purposes, I've appended a slug to an id, like so:</p>
  
  <pre><code>/browse/12885-evergreen-instrumental
  </code></pre>
  
  <p>by using this in my model:</p>
  
  <pre><code>  def to_param
      "#{id}-#{slug}" || id
    end
  </code></pre>
  
  <p>Ideally, I'd like to have the structure as so:</p>
  
  <pre><code>/browse/12885/evergreen-instrumental
  </code></pre>
  
  <p>I've tried several things via routes.rb to accomplish this, but to no avail yet.</p>
  
  <p>Essentially, I'm trying to do this:</p>
  
  <pre><code>match "/browse/:id/:slug" =&gt; "tracks#show", as: :track
  </code></pre>
  
  <p>and than will want a redirect:</p>
  
  <pre><code>get '/browse/:track_id', to: redirect('/browse/%{track_id}/%{slug}')
  </code></pre>
  
  <p>Any ideas on how to get this to actually work?
  Thanks in advance.</p>