How should I write multiple condition in after_create callbacks

Viewed 5352

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?

2 Answers

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.

Related