Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
can.Model#save: values for attributes not found in response are replaced with their defaults #560
I have a model with default values for some attributes.
For example I have a model with attribute 'a' and default value for that attribute is 100. I set the value to 90 and call model save that performs update operation. On update I return some attributes and 'a' is not there.
After looking into code I found that if attributes from server are supplied then 'model' method is called and new model instance with default attribute values is created. The created instance is then used to update current model instance replacing current values with defaults.
I think the behavior is incorrect and default attribute values should not be applied.
Not anymore. You can add defaults to the prototype directly now.
Sent from my iPhone
documented. I'll change the test to reflect.
referenced this issue
Nov 23, 2013
The long-term fix is to support a
For 2.0.3, I am thinking that if