Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clone instance #151

Closed
SystemParadox opened this issue Jun 4, 2015 · 1 comment
Closed

Clone instance #151

SystemParadox opened this issue Jun 4, 2015 · 1 comment

Comments

@SystemParadox
Copy link
Contributor

Related to #57, but probably useful generally, it would be nice if there was an easy way to get an item from the store as a copy rather than having identity mapping.

This would make it easier to use update rather than save to avoid polluting the store with changes that aren"t saved yet.

Thanks.

@jmdobry
Copy link
Member

jmdobry commented Jun 4, 2015

Whatever utility library you"re using probably has a clone method, but here are two ways to do it with js-data:

var userCopy = store.utils.copy(User.get(1));
var user2Copy = User.createInstance(User.get(2));

@jmdobry jmdobry closed this as completed Jun 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants