added the line @task = Task.find(params[:id]) to the show method in the controller.