Run after_commit callbacks on new Active Record instances.
after_commit
Requires Rails ~> 3 and Ruby 1.9.2.
class User < ActiveRecord::Base include WasNewRecord
after_commit :deliver_welcome, if: :was_new_record?
end