I have, Transaction.has_many :splits
and Split has an amount:integer
attribute. I’d like to ensure transaction.splits = [split1, split2, ...]
the sum of split1.amount + split2.amount + … == 0. It seems that
:before_add deals with the splits one by one whereas what I’d like is to
check the array that’s being assigned ([split1, ..]
) beforehand. Is
such
a thing possible?