title: user has_many :courses, but course doesn't belong_to :user
body: <p>I've been struggling with something that's probably very obvious:</p>
  
  <p>When I try and assign courses to users, I don't think it's allowing for a course to be in the collection of more than one user.</p>
  
  <p>I have a method which iterates through every user and assigns a subsection of every course to that user.  Only the last few users have courses assigned to them.  I think this is because the relationship between the two is stored as a field in the courses table, so a course can only belong to one user.  I want courses to belong to many users.</p>
  
  <p>Thinking about it, I'm assuming this is because I need another kind of relationship than has_many?  Like HABTM?</p>
  
  <p>I think I'm confused about how AR associations work...</p>
  
  <p><strong>user.rb</strong></p>
  
  <pre class="lang-rb prettyprint-override"><code>class User &lt; ActiveRecord::Base
    has_many :courses
    has_many :bookmarks, :class_name =&gt; 'Course'
  
    attr_accessible :email, :password, :courses, :bookmarks
  
    validates_presence_of :password, :on =&gt; :create
    validates_presence_of :email, :on =&gt; :create
    validates :password, :length =&gt; { :in =&gt; 6..20 }
    validates_format_of :email, :with =&gt; /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i
    validates_uniqueness_of :email
  end
  
  # == Schema Information
  #
  # Table name: users
  #
  #  id              :integer         not null, primary key
  #  email           :string(255)
  #  password_digest :string(255)
  #  course_id       :integer
  #  bookmark_id     :integer
  #  created_at      :datetime        not null
  #  updated_at      :datetime        not null
  #
  </code></pre>
  
  <p><strong>course.rb</strong></p>
  
  <pre class="lang-rb prettyprint-override"><code>class Course &lt; ActiveRecord::Base
    attr_accessible :name
  end
  
  # == Schema Information
  #
  # Table name: courses
  #
  #  id          :integer         not null, primary key
  #  name        :string(255)
  #  created_at  :datetime        not null
  #  updated_at  :datetime        not null
  #  user_id     :integer
  #
  </code></pre>