aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/environments/environment.rb2
2 files changed, 3 insertions, 1 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 516bd5b27d..0f5f82feca 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Allow ERb in the database.yml file (just like with fixtures), so you can pull out the database configuration in environment variables #1822 [Duane Johnson]
+
* Added convenience controls for FCGI processes (especially when managed remotely): spinner, spawner, and reaper. They reside in script/process. More details can be had by calling them with -h/--help.
* Added load_fixtures task to the Rakefile, which will load all the fixtures into the database for the current environment #1791 [Marcel Molina]
diff --git a/railties/environments/environment.rb b/railties/environments/environment.rb
index 4131c5cb16..896a8faf49 100644
--- a/railties/environments/environment.rb
+++ b/railties/environments/environment.rb
@@ -61,7 +61,7 @@ require 'action_web_service'
# Environment-specific configuration.
require_dependency "environments/#{RAILS_ENV}"
-ActiveRecord::Base.configurations = File.open("#{RAILS_ROOT}/config/database.yml") { |f| YAML::load(f) }
+ActiveRecord::Base.configurations = YAML::load(ERB.new((IO.read("#{RAILS_ROOT}/config/database.yml"))).result)
ActiveRecord::Base.establish_connection