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

Better support for model.save with partial setting of nested attributes #143

Open
ambischof opened this issue Aug 4, 2015 · 0 comments
Open

Comments

@ambischof
Copy link

Lets say we have the following user:

bob = new MyModel({
   name: {
       first: 'bob',
       middle: 'bill',
       last: 'smith'
   }
})

if you do bob.set({name.first: "Bob"}) you'd get

{
   name: {
       first: 'Bob',
       middle: 'bill',
       last: 'smith'
   }
}

but if you try to do bob.save({'name.first': "Bob"}) you would get

{
   'name.first': 'Bob',
   name: {
       first: 'bob',
       middle: 'bill',
       last: 'smith'
   }
}

In order to avoid unintended consequences, there should be some mechanism to use save the same way you would use set.

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

No branches or pull requests

2 participants