     end
   end
 
-  def delete(conn, %{"id" => id}) do
-    annotation = Repo.get!(Annotation, id)
+  def delete(conn, %{"id" => _}) do
+    annotation = conn.assigns[:annotation]
 
     # Here we use delete! (with a bang) because we expect
     # it to always work (and if it does not, it will raise).


    send_resp(conn, :no_content, "")
  end
end

    end
  end

  def show(conn, %{"id" => _}) do
    annotation = conn.assigns[:annotation]
    |> Repo.preload(:annotation_tags)

    conn
    |> render("show.json", annotation: annotation)
  end

  def update(conn, %{"id" => _, "annotation" => annotation_params}) do
    annotation = conn.assigns[:annotation]
    changeset = Annotation.changeset(annotation, annotation_params)

    case Repo.update(changeset) do
