title: Prevent infinite loop when updating attributes within after_commit, :on => :create
body: <p>I create an infinite callback loop when I need to update an attribute during an <code>after_commit, :on =&gt; :create</code>. It only occurs if I need to update an attribute of the object during this callback, though. Is there a way to prevent this? Can I somehow force a model to reload itself so it knows that it is performing an update rather than a create?</p>
  
  <pre><code>class Doc &lt; ActiveRecord::Base
    after_commit :generate, :on =&gt; :create
  
    ...
  
    def generate
      # some logic here that requires this model to be saved in the db
  
      self.update_attributes(:filename =&gt; filename) # Infinite loop begins here.
    end
  end
  </code></pre>