title: Active Record Association Type Mismatch
body: <p>I have nested results upon matches like this</p>
  
  <p>/matches/16/results/13/edit</p>
  
  <p>Where I have the following select field, this shows the correct information ( team.name and its team.id)</p>
  
  <pre><code>&lt;%= f.collection_select :winner, @select_winner_loser, :id, :name %&gt;
  </code></pre>
  
  <p>Now when I try to edit my result and selecting a winner I get this:</p>
  
  <p>ActiveRecord::AssociationTypeMismatch <em>Team(#10504340) expected, got String(#6163240)</em></p>
  
  <p><em>"Raised when an object assigned to an association has an incorrect type."</em> <a href="http://api.rubyonrails.org/classes/ActiveRecord/AssociationTypeMismatch.html" rel="nofollow">http://api.rubyonrails.org/classes/ActiveRecord/AssociationTypeMismatch.html</a></p>
  
  <p>Winner is a <strong>team</strong> object, <strong>result.rb</strong> looks like this</p>
  
  <pre><code>class Result &lt; ActiveRecord::Base
      has_one :match
      belongs_to  :winner, class_name: "Team"
      belongs_to  :loser, class_name: "Team"
  end
  </code></pre>
  
  <p>@select_winner_loser comes from my results_controller</p>
  
  <pre><code>  def edit
      @select_winner_loser = []
      @select_winner_loser &lt;&lt; @match.top
      @select_winner_loser &lt;&lt; @match.bottom
    end
  </code></pre>
  
  <p>Match.top &amp; bottom is also team objects</p>
  
  <pre><code>class Match &lt; ActiveRecord::Base
      belongs_to  :top, class_name: "Team"
      belongs_to  :bottom, class_name: "Team"
      ...
      belongs_to  :result
  end
  </code></pre>
  
  <p>I dont see why I would get this since I have the correct objects in my select field, any ideas?</p>
  
  <p>Thanks</p>