If you are experimenting with this in your test suite, you need to set self.use_transactional_fixtures = false for this class. By default, Rails runs a test package inside a transaction and rolls back at the end to clear it. This makes your tests quick, but if you rely on transaction control yourself or this callback, it will not work.
source share