Backbone model.destroy() invoking error callback function even when it works fine?

后端 未结 5 1255
不知归路
不知归路 2021-02-05 01:01

I have a Backbone.js model that I\'m trying to destroy when the user clicks a link in the model\'s view. The view is something like this (pseudocode because it\'s implemented in

5条回答
  •  独厮守ぢ
    2021-02-05 02:00

    Are you sure of your URL ? Do you append a .json at the end of the Backbone.Model url ? Since you check this on your server side (respond_to do |format| ... end), you might not send the correct head :ok response

    Try with this destroy rails method to test if this is the problem :

    def destroy
      @save = current_user.team.listing_saves.find(params[:id])
      @save.destroy
      head :ok
    end
    

提交回复
热议问题