diff options
Diffstat (limited to 'railties/lib/rails/application')
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 14 | ||||
-rw-r--r-- | railties/lib/rails/application/finisher.rb | 7 |
2 files changed, 9 insertions, 12 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 2c7ddd86e7..17763b39c5 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -97,12 +97,16 @@ module Rails self end - # Loads and returns the contents of the #database_configuration_file. The - # contents of the file are processed via ERB before being sent through - # YAML::load. + # Loads and returns the configuration of the database. + # First, looks at If ENV['DATABASE_URL'] if it's not present it uses the #paths["config/database"] + # The contents of the file are processed via ERB before being sent through YAML::load. def database_configuration - require 'erb' - YAML.load ERB.new(IO.read(paths["config/database"].first)).result + if ENV['DATABASE_URL'] + {Rails.env => ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver.connection_url_to_hash(ENV['DATABASE_URL']).stringify_keys} + else + require 'erb' + YAML.load ERB.new(IO.read(paths["config/database"].first)).result + end rescue Psych::SyntaxError => e raise "YAML syntax error occurred while parsing #{paths["config/database"].first}. " \ "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \ diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index 872d78d9a4..3ae60312c5 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -89,13 +89,6 @@ module Rails ActionDispatch::Reloader.to_cleanup(&callback) end end - - # Disable dependency loading during request cycle - initializer :disable_dependency_loading do - if config.eager_load && config.cache_classes - ActiveSupport::Dependencies.unhook! - end - end end end end |