dimanche 27 août 2023

Updating Record in a after commit call back will trigger infinite calls again and again?

for example

class Order < ApplicationRecord
  after_commit :update_status

  def update_status
     self.update_attribute(:status, 'completed')  
  end
end

im wondering, how this will be handled in rails?

Is it tirgger again and again?

because in some scenarios, its triggering but in some scenrios its not.

Aucun commentaire:

Enregistrer un commentaire