title: ActiveSupport's class_attribute undefined
body: <p>I'm comfortable using Rails but I wanted to learn more about Ruby outside of the framework and thought about writing a gem for a particular problem. I started picking apart of couple (dynamoid and mongoid) to follow their pattern. I've fallen at the first and would welcome some help.</p>
  
  <p>I have a module which looks like this:</p>
  
  <pre><code>module MyModule
    module Document
      extend ActiveSupport::Concern
      include Components
  
      included do
        class_attribute :foo
      end
    end
  end
  </code></pre>
  
  <p>This imports another module which just a convince bag for extensions</p>
  
  <pre><code>module MyModule
    module Components
      include Fields
    end
  end
  </code></pre>
  
  <p>and finally includes another module which looks like this:</p>
  
  <pre><code>module MyModule
    module Fields
      extend ActiveSupport::Concern
  
      included do
        class_attribute :bar
      end
    end
  end
  </code></pre>
  
  <p>This follows the pattern of the other gems. </p>
  
  <p>The <code>class_attribute</code> call in <code>MyModule::Document</code> works fine, as I would expect.</p>
  
  <p>My problem is that I'm getting a <code>undefined method `class_attribute' for MyModule::Components:Module (NoMethodError)</code> in the Fields module. Now, this seems to make sense in that <code>MyModule::Fields</code> is being included in a module, not a class, and module doesn't have a <code>class_attribute</code> method. I just can't see how these other two gems are performing this trick or if there's an idiom I'm missing?</p>