I have a method in model that calls after create
after_create :generate_insurer_recovery_invoice, if: :insurance_recovery_batch?
How should I write another condition within this callback?
You can also do this for a shorter readable version
after_save :update_offices_people_count if: -> {office_id_changed? || trashed_changed?}
P.S: ->
is a shorthand version of writing lambda
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With