Return to Snippet

Revision: 1881
at November 17, 2006 22:10 by stuckinrealtime


Initial Code
def my_method!
  #- Your Method Code Here -#
  self.class.changed
  self.class.notify_observers(:my_method, self)
end

That will call any observers 'my_method' method.

Initial URL


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

Originally found at http://rails.techno-weenie.net/forums/1/topics/672?page=6,
so don't give me any credit ;)

Initial Title
Make Observers For Your Own Methods

Initial Tags
rails

Initial Language
Ruby