Reputation: 21536
I seem to run into these sorts of 'routing' issues somewhat regularly, and they then disappear without my knowing what I've done to improve the situation.
Currently, I have a backbone model which I am deleting
delete_class: function(){ this.model.destroy(); }
This sends a delete request to the server. In the console I get DELETE http://192.168.7.25:3000/user_classes 404 (Not Found)
in my controller, I have
def destroy user_class = UserClass.find(params[:id]) user_class.destroy render :text => 'deleted' end
So clearly it is there. I can make a request to http://192.168.7.25:3000/user_classes
, and the route is found, so the problem only seems to be when trying to DELETE. I haven't tried update, but index and show both return no problem.
Upvotes: 2
Views: 1153
Reputation: 30404
Rails does also respond with a 404 Not Found
error when an ActiveRecord::RecordNotFound
exception occurs. Are your sure your params
hash contains a correct id and are your sure your backbone send this ID corrently to the server?
Upvotes: 3