15
5

More than 1 year has passed since last update.

ActiveRecordで使っているDBの接続情報を調べる

Last updated at Posted at 2020-03-10

手順

  1. サーバーが動いていることを確認する
  2. rails cをする
  3. irbの中で下記のActiveRecord〜を実行する

Rails 6.1以降

irb(main):001:0> ActiveRecord::Base.connection_db_config
# => #<ActiveRecord::DatabaseConfigurations::HashConfig:0x000000000 ...

Rails 6.0以前

irb(main):001:0> ActiveRecord::Base.connection_config
# => {:pool=>5, :timeout=>5000, :database=>"db/development.sqlite3", :adapter=>"sqlite3"}

参考リンク

15
5
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
5