From: Max Muermann Date: 2006-08-25T07:06:26+09:00 Subject: Re: Observing changes in object state > > # Observer > class Watcher > def initialize m > m.when_name Object do > puts "name set to #{m.name.inspect}" > end > > m.when_id Object do > puts "id set to #{m.id.inspect}" > end > # note that each method is treated separately Yes, this is probably the most widely useful approach. I have found that sometimes, though, you want to be notified if *any* of the state in an object changes. For example, checking an model object for "dirty" and enabling a save button or similar. In those cases, I think a generic solution that does not explicitly require defining a watcher method on each attribute may be useful. By the way, thanks for bringing this up - I wasn't aware of the observable :field notation. Cheers, Max