title: Query associated tables in ruby on rails
body: <p>So I am working to understand ruby on rails.  I have 3 tables with the below associations.  I want to query all of the items on the product table and each products associated data.  </p>
  
  <p>For instance I want to render in my react component: </p>
  
  <p>Product Name   <strong>comes from product table</strong></p>
  
  <p>Product UPC    <strong>comes from product table</strong></p>
  
  <p>Product Availiable on date  <strong>comes from product table</strong></p>
  
  <p>Property Name(Ex. Material) <strong>comes from property table</strong></p>
  
  <p>Property Value(Ex. Cotton) <strong>comes from product_property table</strong></p>
  
  <pre><code>class Property &lt; ApplicationRecord
    has_many :product_properties
    has_many :products, through: :product_properties
    accepts_nested_attributes_for :product_properties
  end
  
  class Product &lt; ApplicationRecord
    has_many :product_properties
    has_many :properties, through: :product_properties
  end
  
  class ProductProperty &lt; ApplicationRecord
    belongs_to :property, required: false
    belongs_to :product, required: false
  end
  </code></pre>
  
  <p>Right now I understand getting all of the products using:</p>
  
  <pre><code>Product.all
  </code></pre>
  
  <p>What I am not understanding is how to get each product and the associated property and product property.  </p>
  
  <p>I can see <a href="https://guides.rubyonrails.org/active_record_querying.html" rel="nofollow noreferrer">here</a> where they use this method but I am unable to implement this.  </p>
  
  <pre><code>Author.joins(:articles).where(articles: { author: author })
  </code></pre>
  
  <p>Thanks for any help you can give me.</p>