<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,12 +1,7 @@
 class ArticleObserver &lt; ActiveRecord::Observer
   def before_save(record)
     if (record.is_a?(Article) &amp;&amp; record.save_version?) || record.is_a?(Comment)
-      @event = Event.new
-      @event.mode = case
-        when record.is_a?(Comment) then 'comment'
-        when record.new_record?    then 'publish'
-        else 'edit'
-      end
+      @event = Event.new :mode =&gt; Event.mode_from(record)
     end
   end
 </diff>
      <filename>app/cachers/article_observer.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,9 +11,17 @@ class Event &lt; ActiveRecord::Base
   belongs_to :comment
   belongs_to :site
 
+  def self.mode_from(record)
+    case
+      when record.is_a?(Comment) then 'comment'
+      when record.new_record?    then 'publish'
+      else 'edit'
+    end
+  end
+
   protected
     def content_and_user_added
-      errors.add_to_base &quot;Title or Body must be changed&quot; unless %w(publish comment).include?(mode) || article.changed.include?('title') || article.changed.include?('body')
+      errors.add_to_base &quot;Title or Body must be changed&quot; unless %w(publish comment).include?(mode) || article.title_changed? || article.body_changed?
       errors.add_to_base &quot;User must be provided for Article events&quot;   unless (mode == 'comment' &amp;&amp; author) || user_id
     end
 end</diff>
      <filename>app/models/event.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9c612f8c90ca2921086c123d5e574005d00a16b0</id>
    </parent>
  </parents>
  <author>
    <name>rick</name>
    <email>technoweenie@gmail.com</email>
  </author>
  <url>http://github.com/emk/mephisto/commit/8681b6419d3bbe53929dea28ede3d32553944832</url>
  <id>8681b6419d3bbe53929dea28ede3d32553944832</id>
  <committed-date>2008-12-20T10:45:38-08:00</committed-date>
  <authored-date>2008-12-20T10:45:38-08:00</authored-date>
  <message>extract event mode logic to Event.mode_from</message>
  <tree>826d503b1227bb79877842b1811603ae5dc9ff7d</tree>
  <committer>
    <name>rick</name>
    <email>technoweenie@gmail.com</email>
  </committer>
</commit>
