I am having trouble using pop.Connection#ValidateAndCreate in gobuffalo.
purchaseOrder.Items = models.OrderItems{}
... fill purchaseOrder.Items ...
for _, item := range purchaseOrder.Items {
verrs, err := tx.ValidateAndCreate(item)
if err != nil {
return errors.WithStack(err)
}
if verrs != nil {
// show error
}
}
tx
is type *github.com/gobuffalo/pop.Connection
I get the error: reflect: call of reflect.Value.Elem on struct Value
on the line verrs, err := tx.ValidateAndCreate(item)