title: Polymorphic nested form results in AssociationTypeMismatch
body: <h3>Models:</h3>
  
  <pre><code>class User &lt; ActiveRecord::Base
    belongs_to :role, :polymorphic =&gt; true
  
  class Admin &lt; ActiveRecord::Base
    has_one :user, :as =&gt; :role
  
  class Dealer &lt; ActiveRecord::Base
    has_one :user, :as =&gt; :role
  
  class Buyer &lt; ActiveRecord::Base
    has_one :user, :as =&gt; :role
  </code></pre>
  
  <hr>
  
  <h3>Dealer controller:</h3>
  
  <pre><code>  def new
      @dealer = Dealer.new
      respond_to do |format|
        format.html
        format.xml  { render :xml =&gt; @dealer }
      end
    end
  
    def create
      @dealer = Dealer.new(params[:dealer])
      respond_to do |format|
        if @dealer.save
          flash[:notice] = 'Dealer was successfully created.'
          format.html { redirect_to [:admin, @dealer] }
          format.xml  { render :xml =&gt; @dealer, :status =&gt; :created, :location =&gt; @dealer }
        else
          format.html { render :action =&gt; "new" }
          format.xml  { render :xml =&gt; @dealer.errors, :status =&gt; :unprocessable_entity }
        end
      end
    end
  </code></pre>
  
  <hr>
  
  <h3>Error message:</h3>
  
  <blockquote>
    <p>ActiveRecord::AssociationTypeMismatch in Admin/dealersController#create
    User(#41048900) expected, got HashWithIndifferentAccess(#23699520)</p>
  </blockquote>
  
  <h3>Request Parameters:</h3>
  
  <pre><code>{"authenticity_token"=&gt;"+GkeOOxVi1Fxl7ccbV0Ctt5R6shyMlF+3UWgRow2RdI=",
   "dealer"=&gt;{"gender"=&gt;"m",
   "forename"=&gt;"",
   "surname"=&gt;"",
   "company"=&gt;"",
   "address1"=&gt;"",
   "address2"=&gt;"",
   "zipcode"=&gt;"",
   "city"=&gt;"",
   "country"=&gt;"1",
   "user"=&gt;{"email"=&gt;"",
   "password"=&gt;""},
   "phone"=&gt;"",
   "mobile"=&gt;"",
   "fax"=&gt;""},
   "commit"=&gt;"Submit"}
  </code></pre>
  
  <p>I guess my problem is that Rails doesn't convert the "user" hash inside the request hash into a User object — but why and how can I make Rails to do that?</p>