Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Only call DEFAULT_ENV proc one time

  • Loading branch information...
commit 2b6d1da6b4f2a5dc1d51223ddb33b86ceab98479 1 parent d459f75
@rafaelfranca rafaelfranca authored matthewd committed
Showing with 5 additions and 2 deletions.
  1. +5 −2 activerecord/lib/active_record/connection_handling.rb
View
7 activerecord/lib/active_record/connection_handling.rb
@@ -70,10 +70,13 @@ def resolve
private
def config
+ env = DEFAULT_ENV.call.to_s
+
cfg = Hash.new do |hash, key|
entry = @raw_config[key]
env_url = nil
- if key.to_s == DEFAULT_ENV.call.to_s
+
+ if key.to_s == env
env_url = ENV["DATABASE_URL"]
end
env_url ||= ENV["DATABASE_URL_#{key.upcase}"]
@@ -83,7 +86,7 @@ def config
end
@raw_config.keys.each {|k| cfg[k] }
- cfg[DEFAULT_ENV.call.to_s]
+ cfg[env]
cfg
end
Please sign in to comment.
Something went wrong with that request. Please try again.