I create an infinite callback loop when I need to update an attribute during an after_commit, :on => :create
. It only occurs if I need to update an attribute
The problem will be update_attributes
will initiate the after_commit
callback you've used
As mentioned by Rafael, you'd either need to use a callback not triggered by update_attributes
, or use an update method which negates callbacks:
update_column does not initiate callbacks - self.update_column(filename: filename)
after_create only fires when you create a record (not update) - after_create :generate