title: Why is ActiveRecord only looking for a model object with an id = 1?
body: <p>I'm trying to destroy links that belong to a category model (through my browser). I can successfully delete a link that has an <code>id</code> of <code>1</code> and <code>category_id</code> of <code>1</code>, but when I try to delete a link that has any other id I get hit with:</p>
  
  <pre><code>ActiveRecord::RecordNotFound in LinksController#destroy
  Couldn't find Link with id=1 [WHERE "links"."category_id" = 1]
  </code></pre>
  
  <p>Very frustrating, because I'm not trying to delete a link that has an id of 1! But I see in the request parameters that it's always trying to delete a link with <code>"category_id"=&gt;"1",
   "id"=&gt;"1"}</code>, no matter what link I click on. Looking at the links in my development database confirms they exist and have ids that are not 1...</p>
  
  <p>Here's the code for LinksController#destroy:</p>
  
  <pre><code>class LinksController &lt; ApplicationController
  
  def destroy
      @category = Category.find(params[:id])
      @link = @category.links.find(params[:id])
      @link.destroy
      redirect_to category_url(@category)
  end
  </code></pre>
  
  <p>Here's the code for the view where I'm trying to delete these pesky links:</p>
  
  <pre><code>&lt;h1&gt;&lt;%= @category.category %&gt;&lt;/h1&gt;
  &lt;p&gt;&lt;%=  @category.description %&gt;&lt;/p&gt; 
  &lt;ul&gt;
      &lt;% @category.links.each do |link| %&gt;
      &lt;li&gt;
      &lt;%= link_to link.title, link.url %&gt; |
      &lt;%= link_to "delete", category_link_path(@category), :method =&gt; :delete %&gt;
      &lt;/li&gt;
   &lt;% end %&gt;
  </code></pre>
  
  <p>Edit: Added parameters</p>
  
  <pre><code>{"_method"=&gt;"delete",
   "authenticity_token"=&gt;"[removed]",
   "category_id"=&gt;"1",
   "id"=&gt;"1"}
  </code></pre>
  
  <p>Edit: Added config/routes.rb:</p>
  
  <pre><code>LinkManager::Application.routes.draw do
  
    resources :categories do
      resources :links, only: [:create, :destroy]
    end
  
    root :to =&gt; 'categories#index'
  </code></pre>
  
  <p>What am I overlooking? Is there anything I can try?</p>