fix remove handler to also delete references to existing models#207
Conversation
|
Saved model also have |
|
Interesting. Yes, saved models do have a cid. I would need to verify to be certain, but I suspect that I was seeing a mis-association between cid and id. Probably due to destroy calls followed by auto-assignement of different cid's. Giving model.id precedence kept the Would you like further verification? |
|
For backgrid's purposes, the select-all extension only needs 1 candidate key to keep track of which models within the collection were selected. |
|
Sorry I'm not explaining the issue clearly. I think taking a look at the surrounding code will do a better job. Yet the remove handler is trying to delete by cid There's a key mismatch. Which resulted in The PR fixes the problem by using the same approach to removing a |
Fix bug where the remove handler isn't deleting references to existing models
|
Ah Ok thanks. Good catch. |
The backgrid-select-all extension was removing references to unsaved models but not saved models. This fixes the issue by checking for model.id instead of just model.cid: