title: Ruby on rails routes - what does the "as" do?
body: <p>In ruby on rails, what does the "as:" do in route?  </p>
  
  <p>Example: <a href="http://guides.rubyonrails.org/routing.html" rel="nofollow">http://guides.rubyonrails.org/routing.html</a> 1.2</p>
  
  <p>You can also generate paths and URLs. If the route above is modified to be:</p>
  
  <pre><code>get '/patients/:id', to: 'patients#show', as: 'patient'
  </code></pre>
  
  <p>and your application contains this code in the controller:</p>
  
  <pre><code>@patient = Patient.find(17)
  </code></pre>
  
  <p>and this in the corresponding view:</p>
  
  <pre><code>&lt;%= link_to 'Patient Record', patient_path(@patient) %&gt;
  </code></pre>