aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorArthur Neves <arthurnn@gmail.com>2016-05-11 08:04:26 -0400
committerArthur Neves <arthurnn@gmail.com>2016-05-11 08:04:26 -0400
commitf1030fd897640f2d051ee29143544fad5b64d6d3 (patch)
treed8f9ceea12df8d7078a535544318f6098aa98135 /activerecord/lib/active_record
parent525fa7ef7ce02bf3bfd99058ea18547f21c4f715 (diff)
downloadrails-f1030fd897640f2d051ee29143544fad5b64d6d3.tar.gz
rails-f1030fd897640f2d051ee29143544fad5b64d6d3.tar.bz2
rails-f1030fd897640f2d051ee29143544fad5b64d6d3.zip
Dont cache the conn_spec_name when empty
We cannot cache the connection_specification_name when it doesnt exist. Thats because the parent value could change, and we should keep failling back to the parent. If we cache that in a children as an ivar, we would not fallback anymore in the next call, so the children would not get the new parent spec_name.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/connection_handling.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb
index 0a69ad2c0e..bf9fad371d 100644
--- a/activerecord/lib/active_record/connection_handling.rb
+++ b/activerecord/lib/active_record/connection_handling.rb
@@ -96,7 +96,7 @@ module ActiveRecord
# Return the specification name from the current class or its parent.
def connection_specification_name
if !defined?(@connection_specification_name) || @connection_specification_name.nil?
- @connection_specification_name = self == Base ? "primary" : superclass.connection_specification_name
+ return self == Base ? "primary" : superclass.connection_specification_name
end
@connection_specification_name
end