title: Resources with dynamic segments
body: <p>In my rails 4 application, I have the following code:</p>
  
  <pre><code> get "products/:token" =&gt; "products#show"
   delete "products/:token" =&gt; "products#destroy"
   ... (for each HTTP method)
  </code></pre>
  
  <p>I've read the <a href="http://guides.rubyonrails.org/routing.html" rel="nofollow">http://guides.rubyonrails.org/routing.html</a>, but can't figure out if there is just a way to do:</p>
  
  <pre><code>resources :products
  </code></pre>
  
  <p>and have it default to the :token segment instead of :id.</p>
  
  <p>I tried this:</p>
  
  <pre><code>def to_param
    token
  end
  </code></pre>
  
  <p>but this doesn't seem to work</p>