title: Using after_commit only on create
body: <p>I have a UserObserver with <code>after_commit</code> (changed from <code>after_create</code> to avoid a race condition error that id not found) to update the count. But I know for every create, update is executing the <code>after_commit</code> code (which I knew would happen). How can I run the <code>after_commit</code> only on create? I have few solutions but a bit confused. I've tried:</p>
  
  <ol>
  <li>Using <code>after_commit :do_something, :on =&gt; :create</code> in the model.</li>
  <li>Checking the <code>created_at</code> and <code>updated_at</code> in the observer; if they're the same, then it's a new record.</li>
  <li>Using <code>user.new_record?</code></li>
  </ol>
  
  <p>I am confused as I want to use 3rd one, but it's not working and I don't know why. I want to use observers only and not the model. Any ideas on this?</p>