title: Rails - Best practice for abstract class definition and file naming
body: <p>I want to define 3 classes:</p>
  
  <ul>
  <li>a <code>MotherClass</code> (abstract, can not be inferred)</li>
  <li>a <code>SubClassA</code> (inherits from <code>MotherClass</code>)</li>
  <li>a <code>SubClassB</code> (inherits from <code>MotherClass</code>)</li>
  </ul>
  
  <p>What is the best solution to declare it in Rails ?</p>
  
  <p><strong>1. Put everything in app/models/</strong></p>
  
  <ul>
  <li><code>MotherClass &lt; AR::Base</code> in app/models/mother_class.rb</li>
  <li><code>SubClassA &lt; MotherClass</code> in app_models/sub_class_a.rb</li>
  <li><code>SubClassB &lt; MotherClass</code> in app/models/sub_class_b.rb</li>
  </ul>
  
  <p>Advantage: not very complicated to implement</p>
  
  <p>Inconvenient: a big mess in models folder</p>
  
  <p><strong>2. Create a module for the two subclasses</strong></p>
  
  <ul>
  <li><code>MotherClass &lt; AR::Base</code> in app/models/mother_class.rb</li>
  <li><code>MotherModule::SubClassA &lt; MotherClass</code> in app/models/mother_module/sub_class_a.rb</li>
  <li><code>MotherModule::SubClassB &lt; MotherClass</code> in app/models/mother_module/sub_class_b.rb</li>
  </ul>
  
  <p>Advantage: same than Solution 1</p>
  
  <p>Inconvenient: naming <code>MotherModule</code> and <code>MotherClass</code> with different names, but they mean almost the same thing</p>
  
  <p><strong>3. Create a module for the 3 classes</strong></p>
  
  <ul>
  <li><code>MotherModule::Base &lt; AR::Base</code> in app/models/mother_module/base.rb</li>
  <li><code>MotherModule::SubClassA &lt; MotherModule::Base</code> in app/models/mother_module/sub_class_a.rb</li>
  <li><code>MotherModule::SubClassB &lt; MotherModule::Base</code> in app/models/mother_module/sub_class_b.rb</li>
  </ul>
  
  <p>Advantage: very clean</p>
  
  <p>Inconvenient: need some functions in <code>Base</code> to override (table_name for example)</p>
  
  <hr>
  
  <p>So my question is: What is the best practice in Rails and 
  - how to name my classes?
  - what are their directories?</p>