Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1129] Delete method shouldn't reset model's id

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-10-24T15:19:26.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.6.0
ComponentsModels
Labelscommunity
ReporterTim Poulsen
AssigneeFeon Sua Xin Miao
Created2014-09-08T12:23:35.000+0000
Updated2015-02-18T00:57:17.000+0000

Description

Community PR https://github.com/appcelerator/alloy/pull/547 "Model's ID should not be deleted (reset) in the adapter. The problem is that after the Sync is done Backbone will trigger destroy which will execute a method called _onModelEvent -> remove ,but model doesn't have an id anymore ,so it won't be deleted from a collection - set _byId. If you try to add a new model to the collection with the same ID, backbone will not allow you to do that because the ID already exists in the set."

Attachments

FileDateSize
ALOY-1129.zip2014-09-10T06:18:02.000+00001569832

Comments

  1. Feon Sua Xin Miao 2014-09-10

    Updated test app. Model will not be add to the collection if it was saved first.
       [INFO] :   Models in testCollection: 1, Model ID: 19
       [INFO] :   Models in testCollection: 0, Model ID: null
       [INFO] :   Models in testCollection: 0, Model ID: 19
       [INFO] :   --> []
       
  2. Feon Sua Xin Miao 2014-09-10

    PR merged. 1. Passed all jake tests. 2. Run attached sample app, model ID should not be null and it should be added to the collection.
  3. Tim Poulsen 2014-10-23

    Reopen to backport to 1_6_X branch
  4. Feon Sua Xin Miao 2014-10-24

    1_6_X: https://github.com/appcelerator/alloy/pull/601
  5. Tim Poulsen 2014-10-24

    PR merged
  6. Federico Casali 2015-02-18

JSON Source