Why your pretty, tested, Observer might not work

I normally have my observers tested, so the announcement “there is no mail comming” was pretty irritating at first, until i noticed that it was true. So i began my search … and after quiet some time digging and trying i found that i forgot to add the new observer to the config….

Normal Observer Setup

config.active_record.observers = :user_observer, ....

Automatic Observer Setup
And since i am forgetful, how about auto-loading all observers:

observers = Dir.glob("#{RAILS_ROOT}/app/models/*_observer.rb").map do |file|
config.active_record.observers = observers

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s