title: Rails Remote Database Connection Gives No Tables
body: <p>after creating a <code>rails new</code> project I have modified <code>database.yml</code> to connect to a remote <code>postgresql</code> read-only database that is mantained from a <a href="https://github.com/input-output-hk/cardano-db-sync" rel="nofollow noreferrer"><code>cardano-db-sync</code></a> node:</p>
  <pre class="lang-rb prettyprint-override"><code>development:
    &lt;&lt;: *default
    adapter: postgresql
    encoding: utf8
    database: cexplorer
    username: &lt;%= ENV['PG_USERNAME'] %&gt;
    password: &lt;%= ENV['PG_PWD'] %&gt;
    host: &lt;%= ENV['IP_PG_SERVER'] %&gt;
    port: 5432
    pool: 3 
  </code></pre>
  <p>after running <code>rake db:create</code> I can launch <code>rails server</code> and visit <code>localhost:3000</code> with no problems, no errors about the database are given.</p>
  <p>connecting to the remote database with <code>psql cexplorer -U bswan -h xx.xxx.xx.xxx -p 5432</code> I get no problem and I can see the tables populating the database <code>cexplorer</code>.</p>
  <pre><code>[backend] $ psql cexplorer -U user -h xx.xxx.xx.xxx -p 5432 
  Password for user user: **
  
  cexplorer=# \d
                      List of relations
   Schema |            Name             |   Type   | Owner 
  --------+-----------------------------+----------+-------
   public | block                       | table    | user
   public | block_id_seq                | sequence | user
   public | delegation                  | table    | user
   public | delegation_id_seq           | sequence | user
   public | epoch                       | table    | user
  ...
  ...
  </code></pre>
  <p><strong>Problem</strong></p>
  <p>launching <code>rails console</code> to test the database I get no tables coming back from the connected dabase:</p>
  <pre class="lang-rb prettyprint-override"><code>[backend] $ rails console
  2.6.1 :001 &gt; ActiveRecord::Base.connection.tables
   =&gt; [] 
  </code></pre>
  <p>How come I don't see the tables that I see through <code>psql</code>?</p>
  <pre class="lang-rb prettyprint-override"><code>2.6.1 :002 &gt; ActiveRecord::Base.clear_all_connections!
   =&gt; [#&lt;ActiveRecord::ConnectionAdapters::ConnectionPool:0x00007f9b034a5628 @mon_mutex=#&lt;Thread::Mutex:0x00007f9b034a54c0&gt;, @mon_mutex_owner_object_id=70151875930900, @mon_owner=nil, @mon_count=0, @query_cache_enabled=#&lt;Concurrent::Map:0x00007f9b034a5498 entries=0 default_proc=#&lt;Proc:0x00007f9b034a5380@/Users/sergio/.rvm/gems/ruby-2.6.1/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/query_cache.rb:32&gt;&gt;, @spec=#&lt;ActiveRecord::ConnectionAdapters::ConnectionSpecification:0x00007f9b034a5ab0 @name=&quot;primary&quot;, @config={:adapter=&gt;&quot;postgresql&quot;, :encoding=&gt;&quot;utf8&quot;, :pool=&gt;3, :database=&gt;&quot;cexplorer&quot;, :username=&gt;nil, :password=&gt;nil, :host=&gt;nil, :port=&gt;5432}, @adapter_method=&quot;postgresql_connection&quot;&gt;, @checkout_timeout=5, @idle_timeout=300.0, @size=3, @thread_cached_conns=#&lt;Concurrent::Map:0x00007f9b034a5330 entries=0 default_proc=nil&gt;, @connections=[], @automatic_reconnect=true, @now_connecting=0, @threads_blocking_new_connections=0, @available=#&lt;ActiveRecord::ConnectionAdapters::ConnectionPool::ConnectionLeasingQueue:0x00007f9b034a5150 @lock=#&lt;ActiveRecord::ConnectionAdapters::ConnectionPool:0x00007f9b034a5628 ...&gt;, @cond=#&lt;MonitorMixin::ConditionVariable:0x00007f9b034a5128 @monitor=#&lt;ActiveRecord::ConnectionAdapters::ConnectionPool:0x00007f9b034a5628 ...&gt;, @cond=#&lt;Thread::ConditionVariable:0x00007f9b034a5038&gt;&gt;, @num_waiting=0, @queue=[]&gt;, @lock_thread=false, @reaper=#&lt;ActiveRecord::ConnectionAdapters::ConnectionPool::Reaper:0x00007f9b034a4b60 @pool=#&lt;ActiveRecord::ConnectionAdapters::ConnectionPool:0x00007f9b034a5628 ...&gt;, @frequency=60.0&gt;&gt;] 
  2.6.1 :003 &gt; ActiveRecord::Base.connection.tables
   =&gt; [] 
  </code></pre>