title: Can't delete the HATBM relationship in ruby on rails
body: <p>Not sure how to delete the associate between 'fly' and 'invoice'. What I've tried so far deletes the fly from the database</p>
  
  <pre><code>&lt;table class="table table-condensed"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;Invoice Flies&lt;/th&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;% @invoice.flies.each do |fly| %&gt;
          &lt;tr&gt;
            &lt;td&gt;&lt;%= fly.name %&gt;&lt;/td&gt;
            &lt;td&gt;&lt;%= link_to "delete", ??????, method: :delete,
                                    data: { confirm: "You sure?" } %&gt;&lt;/td&gt;
          &lt;/tr&gt;
        &lt;% end %&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  </code></pre>
  
  <p>Invoice Model:</p>
  
  <pre><code>class Invoice &lt; ActiveRecord::Base
    attr_accessible :active
    validates :user_id, presence: true
    belongs_to :user
  
    has_many :categorizations
    has_many :flies, through: :categorizations
  end
  </code></pre>
  
  <p>Invoice migration:</p>
  
  <pre><code>class CreateInvoices &lt; ActiveRecord::Migration
    def change
      create_table :invoices do |t|
        t.boolean :active
        t.integer :user_id
  
        t.timestamps
      end
      add_index :invoices, :user_id
    end
  
  end
  </code></pre>
  
  <p>Categorization Model:</p>
  
  <pre><code>class Categorization &lt; ActiveRecord::Base
    attr_accessible :fly_id, :user_id
  
    belongs_to :invoice
    belongs_to :fly
  end
  </code></pre>
  
  <p>Categorization migration:</p>
  
  <pre><code>class CreateCategorizations &lt; ActiveRecord::Migration
    def change
      create_table :categorizations do |t|
        t.integer :user_id
        t.integer :fly_id
  
        t.timestamps
  
        add_index :categorizations, :user_id
        add_index :categorizations, :fly_id
      end
    end
  end
  </code></pre>
  
  <p>Fly Model:</p>
  
  <pre><code>class Fly &lt; ActiveRecord::Base
    attr_accessible :description, :name
    validates :description, :name, presence: true
  
    has_many :categorizations
    has_many :invoices, through: :categorizations
  end
  </code></pre>
  
  <p>Fly migration:</p>
  
  <pre><code>class CreateFlies &lt; ActiveRecord::Migration
    def change
      create_table :flies do |t|
        t.string :name
        t.string :description
  
        t.timestamps
      end
    end
  end
  </code></pre>