ga-wdi-boston / full-stack-project

Other
8 stars 64 forks source link

404 delete #1036

Closed jillrizley closed 7 years ago

jillrizley commented 7 years ago

:4741/shows_users:1 DELETE http://localhost:4741/shows_users 404 (Not Found)

getting this error when trying to delete my shows from the my shows list. have tried a whole bunch of different things but can't seem to figure it out.

controller

  def destroy
    @shows_user.destroy
    if @shows_user.destroy

      head :no_content
    else
      render json: @shows_user.errors, status: :unprocessable_entity
    end
  end
benjimelito commented 7 years ago

Can you post your routes.rb file?

cpearce31 commented 7 years ago
@shows_user.destroy
    if @shows_user.destroy

I believe this is trying to destroy @shows_user twice, and it's 404ing the second time because it's already been deleted, so there is no longer a shows_user with id 1.