<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,6 @@
 = Stalker
 
-Rails micro-plugin (35 lines) which allows models to observe each other.
+Rails micro-plugin (38 lines) which allows models to observe each other.
 
 == Install
   
@@ -35,6 +35,27 @@ Now let's see what happens.
 == What happened?
 The stalker class (Idiot) now has magical class methods (such as before_[stalked_class]_save(stalked_instance), after_[stalked_class]_validate(stalked_instance), etc) for reacting to stalked class's callbacks. Keep in mind they're class methods, hence the class &lt;&lt; self thingie.  As an argument these methods get the reference to the instance of the stalked class. This way you can alter the object or just extract information from it.
 
+== Group your victims!
+If you want to stalk multiple models with same responses, it's easy to do using :group option.
+
+  class Celebrity &lt; ActiveRecord::Base
+  end
+  
+  class Politician &lt; ActiveRecord::Base
+  end
+  
+  class Idiot &lt; ActiveRecord::Base
+    stalk Celebrity, Politician, :group =&gt; :victim
+    
+    def self.before_victim_save(victim)
+      if victim.is_a?(Politician)
+        poke(victim)
+      else
+        bite(victim)
+      end
+    end
+  end
+
 == Why?
 Sometimes you want model A to notify model B if something happens to it, so that model B could react. It's useful if it's concern of model B, like it has to update its records. If you have Product model that needs to decrement count of products when Order has been placed, you'd want Order model to notify Product model about the fact that it's been placed. Product can then decrement item count in itself.
 </diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -7,18 +7,21 @@ module Stalker
     def instance; end
     
     def stalk(*models)
+      options = models.extract_options!
       models.flatten!
       
       models.map do |m|
-        m.add_stalker!(self)
+        m.add_stalker!(self, options)
       end
     end
     
-    def add_stalker!(klass)
+    def add_stalker!(klass, options = {})
+      stalkee = options[:group] || self.name.underscore
       establish_channels = &quot;&quot;
+      
       for callback in ActiveRecord::Callbacks::CALLBACKS
         mole = :&quot;notify_#{klass.to_s.underscore}_#{callback}&quot;
-        notify_stalker = :&quot;#{callback.split('_', 2).join(&quot;_#{self.name.underscore}_&quot;)}&quot;
+        notify_stalker = :&quot;#{callback.split('_', 2).join(&quot;_#{stalkee.downcase}_&quot;)}&quot;
         self.send(callback, mole)
         establish_channels += &lt;&lt;-end_code 
           def #{mole}</diff>
      <filename>lib/stalker.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b28273084ed790da68374d72f60c14c9a5bfc73d</id>
    </parent>
  </parents>
  <author>
    <name>Maxim Chernyak</name>
    <email>max@bitsonnet.com</email>
  </author>
  <url>http://github.com/maxim/stalker/commit/4869bbb69ce51233031a904d32f9cf291dc2b6bb</url>
  <id>4869bbb69ce51233031a904d32f9cf291dc2b6bb</id>
  <committed-date>2009-04-10T00:00:53-07:00</committed-date>
  <authored-date>2009-04-10T00:00:53-07:00</authored-date>
  <message>Stalked models can now be grouped. See README for details.</message>
  <tree>3ef06c5f1748f7d12a6142959459adac9c5425f7</tree>
  <committer>
    <name>Maxim Chernyak</name>
    <email>max@bitsonnet.com</email>
  </committer>
</commit>
