不要怂,就是干,撸起袖子干!

Commit 3d5c1fd0 by Mick Hansen

fix: move default field assignment to refreshAttributes rather than init

1 parent 7ee8c7c2
Showing with 5 additions and 5 deletions
......@@ -252,10 +252,6 @@ module.exports = (function() {
if (definition.hasOwnProperty('validate')) {
self.Instance.prototype.validators[name] = definition.validate;
}
if (definition.field === undefined) {
definition.field = name;
}
});
this._hasBooleanAttributes = !!this._booleanAttributes.length;
......@@ -325,6 +321,10 @@ module.exports = (function() {
options.fieldName = attribute;
options._modelAttribute = true;
if (options.field === undefined) {
options.field = attribute;
}
if (options.hasOwnProperty(type)) {
_custom[attribute] = options[type];
}
......@@ -1751,7 +1751,7 @@ module.exports = (function() {
for (attribute in attributes) {
rawAttribute = Model.rawAttributes[attribute];
if (rawAttribute && rawAttribute.field !== rawAttribute.fieldName) {
attributes[Model.rawAttributes[attribute].field] = attributes[attribute];
attributes[rawAttribute.field] = attributes[attribute];
delete attributes[attribute];
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!