title: How do you normally sort items in Rails?
body: <p>I have a little example Rails app called tickets, which views and edits fictional tickets sold to various customers. In tickets_controller.rb, inside <code>def index</code>, I have this standard line, generated by scaffolding:</p>
  
  <pre><code>@tickets = Ticket.find(:all)
  </code></pre>
  
  <p>To sort the tickets by name, I have found two possible approaches. You can do it this way:</p>
  
  <pre><code>@tickets = Ticket.find(:all, :order =&gt; 'name')
  </code></pre>
  
  <p>... or this way:</p>
  
  <pre><code>@tickets = Ticket.find(:all).sort!{|t1,t2|t1.name &lt;=&gt; t2.name}
  </code></pre>
  
  <p>(Tip: Ruby documentation explains that <code>sort!</code> will modify the array that it is sorting, as opposed to <code>sort</code> alone, which returns the sorted array but leaves the original unchanged).</p>
  
  <p><strong>What strategy do you normally use? When might you use <code>.sort!</code> versus the <code>:order =&gt; 'criteria'</code> syntax?</strong></p>