24 Feb 2014, 20:29
Generic-user-small

Alex Marandon (1 post)

In all versions of the Bookmarking App, clicking the Delete button doesn’t remove the bookmark from the list displayed on the page, even though a DELETE request does get sent to the server and the bookmark is deleted from the database.

The code seems to do the right thing according to CanJS doc, which is that simply calling destroy on the bookmark object should remove it from its containing Model.List and therefore from the view through live binding. I’ve tried with the latest release of CanJS and the problem remains.

15 Mar 2014, 15:31
Freddy_avatar_pragsmall

Fred Daoud (21 posts)

Hi Alex,

It seems as though CanJS needs something in the response from the server, not just a 200 success code.

This worked for me: in canjs/app.rb, find the delete block:

delete %r{bookmarks/\d+} do

Within that block, change:

200 # OK

to:

[200, "{}"] # OK

Restart the server, and the deleted bookmark should be removed from the list in the view.

Hope that helps. I’ll see if I can have this update make it into the downloadable code bundle.

  You must be logged in to comment