title: Creating a has_one through a has_many relationship
body: <p>I currently have a <code>ProductSale</code> model that has_many sales.
  Also a sale belongs to an invoice.</p>
  <p>My goal is to access an invoice through a <code>ProductSale</code>'s association to sales. (product_sale.invoice)</p>
  <p>Current <code>ProductSale</code> model below:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>class ProductSale &lt; ApplicationRecord
      has_many :sales
      has_one :invoice, through: :sales
  end</code></pre>
  </div>
  </div>
  </p>
  <p>However my current error is saying that this can't be done because the <code>:through association is a collection</code>, which i understand. Is there a way that this can be possible?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>class Sale &lt; ApplicationRecord
    belongs_to :invoice
   end</code></pre>
  </div>
  </div>
  </p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>class Invoice &lt; ApplicationRecord
    has_many :sales, inverse_of: :invoice, dependent: :destroy
  end</code></pre>
  </div>
  </div>
  </p>