I am opening rails console session and do:
2.6.3 :048 > ActiveRecord::Base.connected?
=> true
2.6.3 :049 > ActiveRecord::Base.connection_pool.disconnect!
=> []
2.6.3 :050 > ActiveRecord::Base.connected?
=> false
2.6.3 :051 > ActiveRecord::Base.establish_connection(:development)
=> #<ActiveRecord::ConnectionAdapters::ConnectionPool:0x00 ... >
2.6.3 :052 > ActiveRecord::Base.connected?
=> false
2.6.3 :053 > SomeModel.connection
=> #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0x00 ...>
2.6.3 :055 > ActiveRecord::Base.connected?
=> true
$ rails -v
Rails 5.2.3
my config/database.yml file has to be fine, because HTTP requests are working fine.
Why I cant establish connection in rails console this way?
I am asking because I have similar use of establish_connection in one of config/initializers/ file, that is configuring sneakers workers like here and there it is also returning me false on ActiveRecord::Base.connected?