     end
   end
 
-  def show(conn, %{"id" => id}) do
-    tag = Repo.get!(Tag, id)
+  def show(conn, %{"id" => _}) do
+    tag = conn.assigns[:tag]
     render(conn, "show.json", tag: tag)
   end
 
-  def update(conn, %{"id" => id, "tag" => tag_params}) do
-    tag = Repo.get!(Tag, id)
+  def update(conn, %{"id" => _, "tag" => tag_params}) do
+    tag = conn.assigns[:tag]
     changeset = Tag.changeset(tag, tag_params)
 
     case Repo.update(changeset) do


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

    end
  end

  def delete(conn, %{"id" => _}) do
    tag = conn.assigns[:tag]

    # Here we use delete! (with a bang) because we expect
    # it to always work (and if it does not, it will raise).
