title: What's the cause of this NoMethodError?
body: <p>I have the following code:</p>
  
  <pre><code>Cms::Page.class_eval do
    def self.fetch_by_slug(slug)
      Rails.cache.fetch("cms_page_#{slug}") { Cms::Page.find_by_slug(slug) }
    end
  end
  </code></pre>
  
  <p>in <code>config/initializers/cms_mp.rb</code></p>
  
  <p>The thing is, I have a call to <code>fetch_by_slug</code> in my layout file, and thus, it's called for each request. In development mode, if I do something that triggers a reload of the classes, I receive the error message <code>undefined method fetch_by_slug for #&lt;Class:0xbff20e8&gt;</code>, and the only fix is to restart the rails devel server.</p>
  
  <p>Why is this happening? How can I fix it?</p>