title: Finding a previous record using 'created_at'
body: <p>Ok so I've got multiple users on my app who each have multiple 'status_updates'. </p>
  
  <p>Each status update is id'd and then has an association for the user it belongs to.</p>
  
  <p>So all the status updates for, say, user 2, might have id's in order 3,10,34,55</p>
  
  <p>The thing is, each status_update needs information from the status update before it for that user. Clearly I can't simply find the status update with id - 1 because that status update may belong to a different user, and will return nil anyways since that status update doesn't exist for the user at hand.</p>
  
  <p>I don't know how to write the where() arguments in order to simply find the previously created status update for the user. </p>
  
  <p>Soo...</p>
  
  <p>Here are the vital parts of my model regarding this question:</p>
  
  <pre><code>after_find :previous_status_update   
  .
  .
  .
  def previous_status_update
   current_id = self.id
   previous_status_update = user.status_update.where( created_at: ? &lt; self.created_at ).limit(1)
  end  
  </code></pre>
  
  <p>The instructions on guides.rubyonrails.org are confusing when it comes to writing the arguments for this. </p>
  
  <p>Thanks for your help!</p>