Hi, I have a peculiar problem. I use the after_commit callback to send notifications, but it looks like the callback is not starting at all. A simplified situation is as follows:
class Message < ActiveRecord::Base after_commit :do_something def do_something raise 'Doing something' end end
Then I expected to see a raise when I open the console and create a message. But nothing happens. Also, the rails don't even complain if I completely remove the do_something method. Please note that this is not a test with transaction lights. I even see the entry recorded in db. My rails version is 3.0.9. Thanks for any help, especially if it's good :-)
Edit: I later found out that the callback DID is triggered when the code is deployed to another machine. So this should be something with my setup. However, I would appreciate your understanding of what might be causing this.
Edit2: From the comments.
- The database is MySQL, so transactions are present.
- Specifying a callback action did not help (: on =>: create).
- I need after_commit and no other callback
source share