title: Implementing has_many :through to Subcategories in Rails 4
body: <p>I would like to implement subcategories for my Products. </p>
  
  <p>So far I have this:</p>
  
  <pre><code>class Category &lt; ActiveRecord::Base
    has_many :subcategories, dependent: :destroy
  end
  
  class Subcategory &lt; ActiveRecord::Base
    has_one :category
    has_many :products
  end
  
  class Product &lt; ActiveRecord::Base
    belongs_to :subcategory
  end
  </code></pre>
  
  <p>And it works totally OK, however I would like to take this further and implement a has_many through association between these models, so that every Product will belong to a Category through a subcategory (so that I could check how many products are in a certain category in total, etc.). But cant seem to get it right. Does this even make sense or should I just stick with the first version I have on top?</p>