title: Sort by date attribute in rails list
body: <p>I have a table in my app that currently displays items in the order in which they are created. I would like them to sort by my date attribute (&lt;%= o.dateg %>) in chronological order. Whats the proper rails way to do this? </p>
  
  <p>Controller:</p>
  
  <pre><code>def show
   @occasion = Occasion.find(params[:id])
  end
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>   &lt;% @user.occasions.each do |o| %&gt;
            &lt;td&gt;&lt;%= o.name %&gt;&lt;/td&gt;
            &lt;td&gt;&lt;%= o.pname %&gt;&lt;/td&gt;
            &lt;td&gt;&lt;%= o.dateg %&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Thanks!</p>