title: Invalid foreign key when deleting tags in rails
body: <p>I am following this <a href="http://tutorials.jumpstartlab.com/projects/blogger.html" rel="nofollow noreferrer">tutorial</a>. The tutorial requires me to implement the destroy function for tags.</p>
  
  <p>The tags can be created and shown fine. However, destroying them yields the following error:</p>
  
  <pre><code> Parameters: {"authenticity_token"=&gt;"VcYU8FRqn4oBXCv0NKXuO7yKNdI+9fIk46rY1ZwD7cQ8cqi37nZDVwNnWJLcNMWVq4gi3OU3YFDgzdeTRa1XKw==",
   "id"=&gt;"1"}
    Tag Load (0.5ms)  SELECT  "tags".* FROM "tags" WHERE "tags"."id" = ? LIMIT ?  [["id", 1], ["LIMIT", 1]]
     (0.0ms)  begin transaction
    SQL (2.0ms)  DELETE FROM "tags" WHERE "tags"."id" = ?  [["id", 1]]
     (1.0ms)  rollback transaction
  Completed 500 Internal Server Error in 10ms (ActiveRecord: 3.5ms)
  
  
  
  ActiveRecord::InvalidForeignKey (SQLite3::ConstraintException: FOREIGN KEY constraint failed: DELETE FROM "tags" WHERE "tags"."i
  d" = ?):
  
  app/controllers/tags_controller.rb:13:in `destroy
  </code></pre>
  
  <p>tags_controller.rb</p>
  
  <pre><code>class TagsController &lt; ApplicationController
  
      def index
          @tags = Tag.all
      end
  
      def show
          @tag = Tag.find(params[:id])
      end
  
      def destroy
          @tags = Tag.find(params[:id])
          @tags.destroy
          # Set variable to instance of an object of class Article and call .destroy on it.
      end
  end
  </code></pre>
  
  <p>index.html.erb</p>
  
  <pre><code>&lt;h1&gt;Listing tags&lt;/h1&gt;
  
    &lt;% @tags.each do |tag| %&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;%= tag.name %&gt;&lt;/td&gt;
        &lt;td&gt;&lt;%= link_to 'Show', tag_path(tag) %&gt;&lt;/td&gt;
        &lt;td&gt;&lt;%= link_to 'Delete', tag_path(tag),
                method: :delete,
                data: { confirm: 'Are you sure?' } %&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;% end %&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Is there a step i missed out or something I entered wrong? </p>