title: Extending Active Record to reduce redundancy
body: <p>Suppose I have two classes in a Rails application:</p>
  
  <pre><code>class Subject &lt; ActiveRecord::Base  
    def children?
      Subject.where(:parent_id =&gt; self.id).length &gt; 0
    end
  
   def children
     Subject.where(:parent_id =&gt; self.id)
   end 
  end
  
  
  class Region &lt; ActiveRecord::Base  
    def children?
      Region.where(:parent_id =&gt; self.id).length &gt; 0
    end
  
   def children
     Region.where(:parent_id =&gt; self.id)
   end 
  end
  </code></pre>
  
  <p>What would be the best way to reduce the redundant class methods? Would I extend ActiveRecord with two new methods? If so, how could I write those two new methods to be available for both classes?</p>
  
  <p>Thanks,
  Mike</p>