title: Rails: many to many relationship - creating and associating new records
body: <p>I'm looking at this <a href="http://railscasts.com/episodes/17-habtm-checkboxes-revised?view=comments" rel="nofollow noreferrer">railscast #17 revised</a> as a tutorial to create a many to many relationship between two models using a join table:</p>
  
  <pre><code>class Course &lt; ActiveRecord::Base
  has_many :courselocalizations
  has_many :courselocations, through: :courselocalizations
  end
  
  class Courselocation &lt; ActiveRecord::Base
  has_many :courselocalizations
  has_many :courses, through: :courselocalizations
  end
  
  class Courselocalization &lt; ActiveRecord::Base
  belongs_to :course
  belongs_to :courselocation
  end
  </code></pre>
  
  <p>If the user doesn't see an existing <code>courselocation</code> when editing or creating the <code>course</code>, what's the best way for them to create a new <code>courselocation</code> and automatically make the association?</p>