title: Selecting a Record With a Max Value When Grouping
body: <p>So I have a model called 'Project' with fields 'unique_id' and 'version' (as well as other irrelevant fields like name). The unique_id is unique to each project and each project has multiple versions ie.</p>
  
  <p>unique_id | version <br>
  &nbsp; &nbsp; &nbsp; &nbsp; 1  &nbsp;  &nbsp; &nbsp;      | &nbsp; &nbsp;  1 <br>
  &nbsp; &nbsp; &nbsp; &nbsp; 1  &nbsp;  &nbsp; &nbsp;       | &nbsp; &nbsp; 2 <br>
  &nbsp; &nbsp; &nbsp; &nbsp; 2  &nbsp;  &nbsp; &nbsp;       | &nbsp; &nbsp; 1 <br></p>
  
  <p>What I am trying to do is select the newest version of each project and add them to <code>@projects</code> for use by my view (where each project is displayed).</p>
  
  <p>I have no idea how to do this but my thought process was to use <code>Projects.group(:unique_id).count</code> to get a hash of <em>unique_id</em> and count (aka the version) and use that information to pull each record via a  loop. That seems clumsy to me. I also know there is a maximum function but that that won't pull the record, only the max value. Help?!</p>