title: Rails 5.2 multiple database connections issue
body: <p>We have found a few patterns for creating a Rails app with multiple database connections (For example: <a href="https://www.thegreatcodeadventure.com/managing-multiple-databases-in-a-single-rails-application/" rel="nofollow noreferrer">https://www.thegreatcodeadventure.com/managing-multiple-databases-in-a-single-rails-application/</a></p>
  
  <p>The pattern we use is as follows (Actual example):</p>
  
  <pre><code># models/icm_db_base.rb
  class IcmDbBase &lt; ActiveRecord::Base
    self.abstract_class = true
    establish_connection :icm_production
  end
  </code></pre>
  
  <p>Then, for a model that I want to implement this connection, I use:</p>
  
  <pre><code># models/icm_task.rb
  class IcmTask &lt; IcmDbBase
  ... model code here
  end
  </code></pre>
  
  <p>While this does all load up, we get the following oddity when I try to run a test inside rails console (This behavior is replicable on dev and prod):</p>
  
  <pre><code>Loading development environment (Rails 5.2.3)
  2.6.4 :001 &gt; IcmTask.connection_config
  =&gt; DATABASE CONNECTION CONFIG FOR ActiveRecord::Base (DB #1)
  
  2.6.4 :002 &gt; IcmTask.superclass
   =&gt; IcmDbBase(abstract) 
  
  2.6.4 :003 &gt; IcmDbBase.connection_config
   =&gt; DATABASE CONNECTION CONFIG FOR IcmDbBase (DB #2)
  </code></pre>
  
  <p>It becomes clear that this output (While not expected) is actually what has happened, and IcmTask is inheriting its connection from ActiveRecord::Base and NOT inheriting from IcmDbBase as desired/expected.</p>
  
  <p>We are running Rails 5.2.3 and Ruby 2.6.4.</p>
  
  <p>Even more strange is that if I put a log into our web server (puma 4.3.0) the connection config for IcmTask DOES match IcmDbBase as expected and everything works as desired.</p>
  
  <p>Anything obvious here? We cannot get this to inherit the connection as expected for this model no matter what we've tried while inside rails console.</p>