title: rails object expected got string
body: <p>I have seen multiple questions similar to this, but none worked for me. </p>
  
  <p>I have a team model:</p>
  
  <pre><code>class Team &lt; ActiveRecord::Base
    has_one :p1, :class_name =&gt; "Player", :foreign_key =&gt; 'player_id', :validate =&gt; true
    has_one :p2, :class_name =&gt; "Player", :foreign_key =&gt; 'player_id', :validate =&gt; true
  end
  </code></pre>
  
  <p>in my team's _form.html.erb, I am referring to players as</p>
  
  <pre><code>  &lt;%= f.collection_select :p1, Player.all, :id, :name %&gt;
  </code></pre>
  
  <p>However, on form submission, I see the error:</p>
  
  <pre><code>Player(#28401456) expected, got String(#14111904)
  
  Application Trace | Framework Trace | Full Trace
  app/controllers/teams_controller.rb:47:in `new'
  </code></pre>
  
  <hr>
  
  <pre><code>Parameters:
  {"utf8"=&gt;"✓",
   "authenticity_token"=&gt;"GSIcEvROFnvgGWT4HvE2VNqRw4NxU1J8iAw/WhZeRLk=",
   "team"=&gt;{"p1"=&gt;"1"},
   "commit"=&gt;"Create Team"}
  </code></pre>
  
  <p>And here is the code at line </p>
  
  <pre><code>def create
    @team = Team.new(params[:team])
    .....
  end
  </code></pre>
  
  <p>Any ideas please?</p>