views:

279

answers:

1

Could anyone advise how to use custom observer or events/callbacks in Ruby on Rails?

I have tried both these posts:

http://www.mutuallyhuman.com/2009/1/6/using-custom-activerecord-events-callbacks and http:// alexkira.blogspot.com/2008/10/custom-observer-callbacks-in-rails.html

none seems to be working. On the second post, I put Alex Kira's CallbackObservable module inside lib/callback_observable.rb is this the correct place to put it in?

Any feedback is greatly appreciated.

A: 

Ah my bad! The first link's method is working, I just needed to add this inside config/environments.rb: config.active_record.observers = :cart_observer

jaycode