title: Rails has_one association when there are multiple records with foreign_key
body: <p>If I understand <code>has_one</code> correctly, the foreign key is on the associated record. This means that I could have multiple related records on the "foreign" side. When I use the <code>has_one</code> records to get the associated record, how do I determine which one will be returned? </p>
  
  <p>Here's an example:</p>
  
  <pre><code>class Job &lt; ActiveRecord::Base
    has_one  :activity_state
  end
  
  class ActivityState &lt; ActiveRecord::Base
      belongs_to :job
  end
  </code></pre>
  
  <p>Let's say there are 2 rows in the <code>activity_states</code> table that have their foreign key set to Job #1</p>
  
  <pre><code>ActivityState.where(job_id: 1).select(:id, :job_id)
  #=&gt; [#&lt;ActivityState id: 1, job_id: 1&gt;, #&lt;ActivityState id: 2, job_id: 1]
  </code></pre>
  
  <p>When I try to get the <code>activity_state</code> from the JobRequest, how do I determine which one is returned?</p>
  
  <pre><code>JobRequest.find(1).activity_state
  #=&gt; #&lt;ActivityState id: 1, job_id: 1&gt;
  </code></pre>
  
  <p>Right now, it looks like it is returning the first one it finds.</p>
  
  <p>What if I wanted to return the <em>latest</em> one that was created?</p>