title: Cannot destroy items in rails
body: <p>I have the following code</p>
  
  <pre><code>def destroy
    @demand_site = DemandSite.find(params[:id])
    @demand_site.destroy
    flash[:success] = "Demand Site destroyed."
    redirect_to demand_sites_path
  end
  </code></pre>
  
  <p>To destroy an item in my sql table. Here is my migrate-file</p>
  
  <pre><code>def change
    create_table :demand_sites do |t|
      t.integer :site_id
      t.float :demand_quantity
      t.timestamps
    end
  end
  </code></pre>
  
  <p>When I want to destroy an item the following error occurs:</p>
  
  <blockquote>
    <p>SQLite3::SQLException: no such column: translinks.demand_site_id: SELECT "translinks".* FROM "translinks"  WHERE "translinks"."demand_site_id" = 14</p>
  </blockquote>
  
  <p>where the id number changes. I can add new items and change them, but not destroy them afterwards. When I take a look in to the SQL table it shows me the correct columns and ids. I can delete them manually but not via rails.</p>
  
  <p>How can I solve this problem?</p>
  
  <p>The view page</p>
  
  <pre><code>&lt;% @demand_sites.each do |demand_site| %&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;%= demand_site.site.codename %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= demand_site.site.name %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= best_in_place demand_site, :demand_quantity, :type =&gt; :input%&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= link_to 'Show', demand_site %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= link_to 'Update', edit_demand_site_path(demand_site) %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= link_to 'Destroy', demand_site, method: :delete, data: { confirm: 'Are you sure?' } %&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;% end %&gt;
  </code></pre>