From 2ff17d65e42570f78ea87edc43e80167e5be34c1 Mon Sep 17 00:00:00 2001 From: Jason Seriff Date: Fri, 5 Aug 2016 15:49:41 -0500 Subject: [PATCH] Remove looping when saving an association slice, to not repeat the updates --- association.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/association.go b/association.go index 0f94683d..87a7a882 100644 --- a/association.go +++ b/association.go @@ -353,9 +353,7 @@ func (association *Association) saveAssociations(values ...interface{}) *Associa if indirectReflectValue.Kind() == reflect.Struct { saveAssociation(reflectValue) } else if indirectReflectValue.Kind() == reflect.Slice { - for i := 0; i < indirectReflectValue.Len(); i++ { - saveAssociation(indirectReflectValue.Index(i)) - } + saveAssociation(indirectReflectValue) } else { association.setErr(errors.New("invalid value type")) }