Posted By

stuckinrealtime on 11/17/06


rails activerecord

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


Make Observers For Your Own Methods

 / Published in: Ruby

Rails builds on the standard Ruby observer, so you can too.

Originally found at, so don't give me any credit ;)

  1. def my_method!
  2. #- Your Method Code Here -#
  3. self.class.changed
  4. self.class.notify_observers(:my_method, self)
  5. end
  7. That will call any observers 'my_method' method.

Report this snippet  

You need to login to post a comment.