title: Rails: Association between Category, Subcategory, and Lawyer
body: <p>I have a vast list of Lawyers, Categories, and Subcategories. </p>
  
  <p><strong>Hint</strong> (so you could have a clue if my associations are okay)</p>
  
  <ol>
  <li>On Categories Table, I do not want to see a column on Categories Table referencing Subcategories.</li>
  <li>On Subcategories Table, I do not want to see a column on Subcategories Table referencing Categories.</li>
  <li>Not all Categories has Subcategories. i.e. some don't have subcategories as seen in the picture.</li>
  <li>I have 2 separate forms creating category and subcategory.</li>
  <li>I added category_id and subcategory_id as foreign keys to my lawyers table. Such that I can choose from lawyers form upon create, the category or subcategory a lawyer will belong to as soon in the image.</li>
  <li><strong>Also note:</strong> A Subcategory could be created at any time, any day, for Categories not having Subcategory, as well as new Subcategories under Categories already having some Subcategories, and lawyers will be placed under them.</li>
  <li>The image is a replica of my index/homepage I am having at the moment, at least before number 6 above takes effect any time any day, and I hope to use loop to make this view happen.</li>
  </ol>
  
  <p><strong>Pictorial understanding of what I am trying to do:</strong></p>
  
  <blockquote>
    <p><a href="https://i.stack.imgur.com/MRBYV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MRBYV.png" alt="image description of my homepage"></a></p>
  </blockquote>
  
  <p><strong>Here are my relationships between 3 models</strong></p>
  
  <pre><code>class Lawyer &lt; ActiveRecord::Base
    belongs_to :category
    belongs_to :subcategory
  end
  
  class Category &lt; ActiveRecord::Base
    has_many :lawyers
  end
  
  class Subcategory &lt; ActiveRecord::Base
    #belongs_to :category #Do I want "category_id" in Subcategories Table?
    has_many :lawyers
  end
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <blockquote>
    <p>Is my association on those 3 models okay for the Hint I gave? This is
    pretty confusing.</p>
  </blockquote>