title: How to link form after creating rails join table
body: <p>Hi have a products model in my Rails 3.1 app which looked like this: </p>
  
  <pre><code>+----------------+---------------+------+-----+---------+----------------+
  | Field          | Type          | Null | Key | Default | Extra          |
  +----------------+---------------+------+-----+---------+----------------+
  | id             | int(11)       | NO   | PRI | NULL    | auto_increment |
  | type           | text          | YES  |     | NULL    |                |
  | title          | text          | YES  |     | NULL    |                |
  | description    | text          | YES  |     | NULL    |                |
  | price          | text          | YES  |     | NULL    |                |
  | img_src        | text          | YES  |     | NULL    |                |
  | source         | text          | YES  |     | NULL    |                |
  | sr_id          | text          | YES  |     | NULL    |                |
  | categories     | text          | YES  |     | NULL    |                |
  +----------------+---------------+------+-----+---------+----------------+
  </code></pre>
  
  <p>I created a Categories_Products using the following migration (Did not create a model):</p>
  
  <pre><code>class CreateCategoriesProducts &lt; ActiveRecord::Migration
    def change
      create_table :categories_products, :id =&gt; false do |t|
        t.references :product
        t.text :categories
        t.timestamps
      end
    end
  end
  </code></pre>
  
  <p>1) How do I set up my products form so that when Categories text_field is filled in, it will update the join table I just created. I deleted the categories column from the products table.</p>
  
  <p>2) The whole reason I did this is because I initially had multiple Category ID's in a single field, and needed to break them up so that I could easily perform distinct counts and such. The user needs to be able to add multiple categories per a product, how can I tell Rails to save each category added into a new row in the db? </p>