26
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rails4のdatabase.ymlのファイル名を変更する

Last updated at Posted at 2013-08-23

Rails4 では datbase.yml のファイル名は実際には AppName::Application.config.paths["config/database"].first の内容で管理されている。

例えば config/application.rb の中でこんな内容を書けば

  if !Rails.env.production? && File.exist?(Rails.root + "config/database.local.yml")
    config.paths.add "config/database", with: "config/database.local.yml"
  end

config/database.local.yml が存在するときのみそちらを読むなんてことが可能。

26
24
0

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
26
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?