← Back to Upcase

Updating parent's model


(Amree Zaid) #1

Hello

I have Bill and Payment model. If all payment has been made (through Payment model), where should I put the method to mark the Bill (using is_paid) as paid? Should I put all the codes it in the after_save callback of Payment or just call a method in Bill from Payment or maybe extract it to service object?

I’ve already put it in the after_save method in Payment, but I am wondering whether Payment is doing what it’s not supposed to do which is updating Bill’s record.

Thanks in advance.