title: Rails: Convert has_many to has_one association
body: <p>Assuming I have an existing app with the following models:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :locations, :through =&gt; :location_users
  end
  
  class Location &lt; ActiveRecord::Base
    has_many :users, :through =&gt; :location_users
  end
  </code></pre>
  
  <p>How do I go about converting this has_many to a has_one association like below, as far as migrations, trimming records of people with multiple locations, and anything else I missed? Are there any shortcuts to do this conversion? </p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    belongs_to :location
  end
  
  class Location &lt; ActiveRecord::Base
    has_many :users
  end
  </code></pre>
  
  <p>EDIT: User belongs to one and only one location</p>