aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-12-30 19:36:06 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-12-30 19:36:06 -0800
commit969a0778cd2fd809a7b4f60c8477bb6d0ac9faf3 (patch)
tree6d71bcbc0c3031cc2aa2336024e873b931f1eec1 /activerecord/lib
parent16e93561e2695afb6e0f264905e35ffd9381123d (diff)
parent5b96027ef6ac6e507ec9caf9973069345ce6a7cd (diff)
downloadrails-969a0778cd2fd809a7b4f60c8477bb6d0ac9faf3.tar.gz
rails-969a0778cd2fd809a7b4f60c8477bb6d0ac9faf3.tar.bz2
rails-969a0778cd2fd809a7b4f60c8477bb6d0ac9faf3.zip
Merge pull request #13541 from schneems/schneems/db-url-sub-key
Allow "url" sub key in database.yml configuration
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/connection_specification.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/connection_specification.rb
index bea9a22442..049768effc 100644
--- a/activerecord/lib/active_record/connection_adapters/connection_specification.rb
+++ b/activerecord/lib/active_record/connection_adapters/connection_specification.rb
@@ -223,7 +223,15 @@ module ActiveRecord
end
end
+ # Accepts a hash. Expands the "url" key that contains a
+ # URL database connection to a full connection
+ # hash and merges with the rest of the hash.
+ # Connection details inside of the "url" key win any merge conflicts
def resolve_hash_connection(spec)
+ if url = spec.delete("url")
+ connection_hash = resolve_string_connection(url)
+ spec.merge!(connection_hash)
+ end
spec
end