Help us understand the problem. What is going on with this article?

Railsでconfig/database.ymlをいくら書き換えても接続するデータベースが固定になる

More than 3 years have passed since last update.
  • 蓋を開けて見れば非常に下らないのですが、検索方法が分からずハマってしまったので自分用にメモ書きしておきます

概要

  • Railsでconfig/database.ymlで接続するデータベースやホストを指定してもrails dbで接続したときにいつも固定のデータベースに接続してしまう

環境

  • windows10
  • rails 4.2.5

解決法

3.14 Configuring a Database
Just about every Rails application will interact with a database. You can connect to the database by setting an environment variable ENV['DATABASE_URL'] or by using a configuration file called config/database.yml.
  • 環境変数のDATABASE_URLかconfig/database.ymlの設定を見るよ

    • 環境変数を見てみると...いつ登録したのか分からないDATABASE_URL...これか...
  • 環境変数を変更したら忘れずにシェルを再起動してください

  • 終わりです。貴重な土曜日が...

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした