Remove looping when saving an association slice, to not repeat the updates
This commit is contained in:
		
							parent
							
								
									a646b13548
								
							
						
					
					
						commit
						2ff17d65e4
					
				@ -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"))
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user