Skip to content
This repository has been archived by the owner on Aug 25, 2018. It is now read-only.

Adding a model to a firebase collection changes its cid #137

Open
jlowhy opened this issue Jan 20, 2015 · 2 comments
Open

Adding a model to a firebase collection changes its cid #137

jlowhy opened this issue Jan 20, 2015 · 2 comments

Comments

@jlowhy
Copy link

jlowhy commented Jan 20, 2015

When I add a model to a firebase collection, the initial cid value of the model is changed. Is this intended?

This happens when the model object is passed through SyncCollection._parseModels.
_parseModels will return an object that is stripped of everything other than its attributes.

As a result, when the new model is saved and added into the collection, a new cid will be assigned to it.

This behaviour was problematic to me as I assumed that based on backbone.js convention, the cid value will not change upon creation.

@davideast
Copy link
Contributor

Can you provide an example? I'd like to step through the process myself.

@jlowhy
Copy link
Author

jlowhy commented Jan 29, 2015

Hi David, here's a fiddle for it:
http://jsfiddle.net/8cnu309p/2/

I should add that this happens if the model already has a defined id.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants