title: Association Type Mismatch
body: <p>I am getting this error:</p>
  
  <blockquote>
    <p>ActiveRecord::AssociationTypeMismatch (Design(#2199041060) expected, got String(#2151988680))</p>
  </blockquote>
  
  <p>I am trying to create an Event whereby the user enters some information for the event and at the same time selects a Design. Each time I click on the Create button the error happens. </p>
  
  <p>Here are my models:</p>
  
  <pre><code>class Design &lt; ActiveRecord::Base  
    belongs_to  :event        # User creates an Event and selects only one Design
    belongs_to  :user         # User could also create a Design 
  end
  
  class Event &lt; ActiveRecord::Base
    belongs_to  :user     # A user can create as many events
    has_one     :design   # User can only select one design for this event
  end
  </code></pre>
  
  <p>Here is my Event Controller</p>
  
  <pre><code>def create
    @event = Event.new(params[:event])
    @user = current_user
    @designs = Design.all
  
    if @event.save
      flash[:success] = "Event created"
      @user.events &lt;&lt; @event 
      redirect_to events_path
    end
  end
  </code></pre>
  
  <p>Here is my Event View:</p>
  
  <pre><code>&lt;%= form_for @event, :url =&gt; {:action =&gt; 'create', :id =&gt; @event.id } do |e| %&gt;
  &lt;p&gt;Enter a title for this event: &lt;%= e.text_field :title %&gt; &lt;/p&gt;
  
  &lt;p&gt;Select a design:&lt;/p&gt; 
   &lt;ul class = "list"&gt;
      &lt;% @designs.each do |design| %&gt;
          &lt;li&gt;&lt;%= e.radio_button :design, design.id %&gt; &lt;%= design.name %&gt;&lt;/li&gt;
      &lt;% end %&gt;
   &lt;/ul&gt;
      &lt;%= e.submit "Create" %&gt;
  &lt;% end %&gt;
  </code></pre>