sunspot/sunspot — pull request #246 by vanstee (2012-06-15 19:33:26+00:00)
Title: Switch to after commit

Since indexing callbacks were fired off on after_save and after_destory events, we were seeing RecordNotFound exceptions periodically. This just switches those callbacks to use after_commit.

I had to install database_cleaner and tag those specific specs as well to make sure the callbacks were fired. There wasn't really a noticeable difference in speed, but let me know if we should try another approach.

Also added `Sunspot.config.indexing.auto_index_callback` as an option that defaults to `:after_save` as @@jmileham and @alindeman suggested. Thanks guys!