title: How can I load an STI record using just the base STI class?
body: <p>Say I have models using STI like so:</p>
  
  <pre class="lang-rb prettyprint-override"><code>class MyBase &lt; ApplicationRecord ; end
  class MyBase::MySubclass1 &lt; MyBase ; end
  class MyBase::MySubclass2 &lt; MyBase ; end
  </code></pre>
  
  <p>When I lookup records using the base class, the records all load with the class in the type column.</p>
  
  <pre class="lang-rb prettyprint-override"><code>MyBase.all.to_a.map { |record| record.class.name }
  # =&gt; [MyBase::MySubclass1, MyBase::MySubclass2]
  </code></pre>
  
  <p>99 times out of 100 this is a good thing, but is it possible to have these records load into their base class instead of the class in the type column? eg</p>
  
  <pre class="lang-rb prettyprint-override"><code>MyBase.first.class
  # =&gt; MyBase
  </code></pre>
  
  <p>I'm hoping there's a way to turn it off in the AR query, something like <code>MyBase.where(condition: :something, use_base: true)</code>...</p>
  
  <p>My use case is that I'm using a gem which expects me to pass it an AR relation, looks at class.name, and breaks when it gets an STI subclass. To avoid patching the gem, I'd like to abide by its limitations and pass it a relation whose records' classes will automatically be coerced into the STI base class when loaded.</p>