Observer doesn't work properly... in development?

Hey all!

Ok, weird problem with observer. Most of the time, the after_create of UserObserver isn't called. It's like it just skips it altogether. However, when I stop the server, add a line "debugger" in the after_create block, and restart the server with the debugger option, and try creating a user again, the callback is executed! If I remove the debugger in the block and restart the server, it's back to ignoring it. Another thing, if I leave the debugger line in the after_create block, but restart the server _without_ the debugger option, when I create a user I see in the logs:

***** Debugger requested, but was not available: Start server with --debugger to enable *****

So, it tells me that it somewhat enters the after_create method but doesn't execute my BackgroundRB Middleman job?

Anyone else see this behavior before?

I asked around in #rubyonrails in freenode and someone mentioned that it might be because I'm running it in development mode. He vaguely remembers a way to run observers properly. I want it to run in development too, of course. Funny thing is, as far as I can tell, my after_save methods are always called.

I hope you guys can help.


I transferred the callback to the model, and it seems that it's the same problem. I think the problem lies in BackgroundRB then, not Rails or the observer. Thanks for reading my previous mail though! Off to the backgroundrb mailing list.

Hi Ramon, I would recommend creating an environment file called staging.rb by doing the following:

cd <RAILS_APP_ROOT>/config/environments

cp production.rd staging.rb

Next, you’ll need to create staging section within your database.yml located in cd <RAILS_APP_ROOT>/config


script/server staging

In short, your staging environment will be used to mimic the actual production environment without hitting the

production server. You don’t really want to start changing the development.rb to work like the production.rb.

Good luck,


Thanks conrad this'll be useful :slight_smile: