I am using ActiveRecord::Relation delete_by method to delete a record but this is not triggering after_commit and after_destroy callbacks. See below example:
class User < ActiveRecord::Base
after_commit :expire_cache
after_destroy :expire_cache
def expire_cache
puts "expire_cache is called"
end
end
User.delete_by(user_id: 1234) # doesn't trigger expire_cache method
Is my expectation about the callbacks is right? What am I doing wrong?