     end
   end
 
-  def delete(conn, %{"id" => id}) do
-    question = Repo.get!(Question, id)
+  def delete(conn, %{"id" => _}) do
+    question = conn.assigns[:question]
 
     # 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


  plug Guardian.Plug.EnsureAuthenticated, %{handler: Core.Auth} when action in [:create, :update, :delete]
  plug Core.BodyParams, name: "question"
  plug :find when action in [:update, :delete, :show]

  def index(conn, _params) do
    questions = Repo.all(Question)
