Skip to content

Cloning a backbone model with relations does not perform deep cloning #50

@aquam8

Description

@aquam8

When cloning a simple backbone object with a HasOne relationalship (by calling model.clone() ) the relation is not cloned. There's only a pointer to the original object (same cid) so it's not deep-copied.

Also i noticed that cloning a model with a HasMany relationship does not copy the models (array) at all.

I think the clone() method needs to be supported by backbone.relational.

None of the test cases (in test/test.js) handle clone() - missing in test coverage.

Let me know your feedback
Thanks lot and well done for the library btw!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions