I have to destroy a big list of data, and update my counter cache, but when I user destroy_all counter cache is called at every delete. Is there any way to update my counter only after the destroy_all?
I already tried ActiveModel Callbacks, but they are the same as destroy_all, called one time for each record.
belongs_to :research, counter_cache: :total_participants
ResearchParticipant.from_research(@research_id).destroy_all