title: How to prepend classmethods
body: <p>This question directly relates to <a href="https://stackoverflow.com/questions/18682494/overriden-method-still-gets-called" title="complex couchbase question">this one</a>. But I tried to break it down to the base problem and I didn't want to enter even more text into the other question box. So here goes:</p>
  
  <p>I know that I can include classmethods by extending the module ClassMethods and including it via the Module#include hook. But can I do the same with prepend? Here is my example:</p>
  
  <p>class Foo:</p>
  
  <pre><code>class Foo
    def self.bar
      'Base Bar!'
    end
  end 
  </code></pre>
  
  <p>class Extensions:</p>
  
  <pre><code>module Extensions
    module ClassMethods
      def bar
        'Extended Bar!'
      end
    end
  
    def self.prepended(base)
      base.extend(ClassMethods)
    end
  end
  # prepend the extension 
  Foo.send(:prepend, Extensions)
  </code></pre>
  
  <p>class FooE:</p>
  
  <pre><code>require './Foo'
  
  class FooE &lt; Foo
  end
  </code></pre>
  
  <p>and a simple startscript:</p>
  
  <pre><code>require 'pry'
  require './FooE'
  require './Extensions'
  
  puts FooE.bar
  </code></pre>
  
  <p>When I start the script I don't get <code>Extended Bar!</code> like I expect but rather <code>Base Bar!</code>. What do I need to change in order to work properly?</p>