title: Database modeling best practice: Dealing with Associations to the same "base"
body: <p>I tried to normalize my database model. But I'm clueless how to do it in this case. Giving the following model:</p>
  
  <ul>
  <li>Customer has many Systems (has_many :systems)</li>
  <li>Cluster has many Systems (has_and_belongs_to_many :systems)</li>
  </ul>
  
  <p>I want to display all Systems of a Customer. That would be: <code>@customer.systemobjects.each</code>. That is already working.</p>
  
  <p>Then I could add a System to a Cluster (which I mentioned is a "HABTM" association). In my Customer view I want to show only systems, that are not related to a cluster (also working with <code>Cluster.includes(:systems).where(systems: { id: sysid }).present?</code>).</p>
  
  <p>Now my question: I want to display all Clusters (and Systems of that Cluster) of a specific customer, too. But, right now, I only to have the connection to customer through systems. For me, it would be easier, to add a reference to customer also in the cluster object (even though I would have this information already in the system).</p>
  
  <p>Should I add this reference? Does it have something to do with normalization anyway? How would you assess this situation from a best practice point of view for a databases in general and for Ruby On Rails in specific? How would also be the best way, to go through each cluster of a customer, when I have it only through systems (how I could do it in rails?)? </p>