title: How do i change Rails routing from controller/:id to controller/:name in Rails 3?
body: <p>Just as the topic say. I want to change the default controller/:id routing to controller/:name instead in Rails 3. In Rails 2 you used named routing with something like this:</p>
  
  <p><strong>config/routes.rb</strong></p>
  
  <pre><code>map.location 'location/:name', 
    :controller =&gt; 'your_controller', :action =&gt; 'your_action'
  </code></pre>
  
  <p><strong>alternate named route</strong></p>
  
  <pre><code>map.location 'goto/:name', :controller =&gt; 'location', :action =&gt; 'your_action'
  </code></pre>
  
  <p><strong>examples of URL specification in a view</strong></p>
  
  <pre><code>&lt;%= link_to 'foo', location_url({:name =&gt; 'foo'}) %&gt;
  &lt;%= link_to 'bar', location_path({:name =&gt; 'bar'}) %&gt;
  </code></pre>
  
  <p>But i'm sure there is another (better) way in Rails 3.</p>