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

Commit 7ee8c7c2 by Mick Hansen

fix: only alias field if field is different

1 parent ff08e29e
Showing with 2 additions and 2 deletions
......@@ -1726,7 +1726,7 @@ module.exports = (function() {
// Object lookups will force any variable to strings, we don't want that for special objects etc
if (typeof attr !== "string") return attr;
// Map attributes to aliased syntax attributes
if (Model.rawAttributes[attr] && Model.rawAttributes[attr].field) {
if (attr !== Model.rawAttributes[attr].field) {
return [Model.rawAttributes[attr].field, attr];
}
return attr;
......@@ -1750,7 +1750,7 @@ module.exports = (function() {
if (attributes) {
for (attribute in attributes) {
rawAttribute = Model.rawAttributes[attribute];
if (rawAttribute && rawAttribute.field && rawAttribute.field !== rawAttribute.fieldName) {
if (rawAttribute && rawAttribute.field !== rawAttribute.fieldName) {
attributes[Model.rawAttributes[attribute].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!