diff options
author | Xavier Noria <fxn@hashref.com> | 2013-04-13 09:04:44 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2013-04-13 09:04:44 +0200 |
commit | 11c697383e6fea7834ee1a8ba2815ff0da20f0fe (patch) | |
tree | 925e9688fb76c78df6dfc5eff4cdea9b77b6e2de /activerecord/lib | |
parent | a548c4591b014e12b54b9b336a33164df93b0625 (diff) | |
download | rails-11c697383e6fea7834ee1a8ba2815ff0da20f0fe.tar.gz rails-11c697383e6fea7834ee1a8ba2815ff0da20f0fe.tar.bz2 rails-11c697383e6fea7834ee1a8ba2815ff0da20f0fe.zip |
removes calls to AR::Runtime.instance
Registries have class-level accessors to write clean code, let's
use them. This makes style uniform also with existing usage in
ScopeRegistry and InstrumentationRegistry.
If performance of the method_missing callback was ever considered to
be a concern, then we should stop using it altogether and probably
remove the callback. But while we have the feature we should use it.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_handling.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/core.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/log_subscriber.rb | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb index 3f175988db..a1943dfcb0 100644 --- a/activerecord/lib/active_record/connection_handling.rb +++ b/activerecord/lib/active_record/connection_handling.rb @@ -54,11 +54,11 @@ module ActiveRecord end def connection_id - ActiveRecord::RuntimeRegistry.instance.connection_id + ActiveRecord::RuntimeRegistry.connection_id end def connection_id=(connection_id) - ActiveRecord::RuntimeRegistry.instance.connection_id = connection_id + ActiveRecord::RuntimeRegistry.connection_id = connection_id end # Returns the configuration of the associated connection as a hash: diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 7a8408155a..733d4e1c67 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -80,11 +80,11 @@ module ActiveRecord class_attribute :default_connection_handler, instance_writer: false def self.connection_handler - ActiveRecord::RuntimeRegistry.instance.connection_handler || self.default_connection_handler + ActiveRecord::RuntimeRegistry.connection_handler || default_connection_handler end def self.connection_handler=(handler) - ActiveRecord::RuntimeRegistry.instance.connection_handler = handler + ActiveRecord::RuntimeRegistry.connection_handler = handler end self.default_connection_handler = ConnectionAdapters::ConnectionHandler.new diff --git a/activerecord/lib/active_record/log_subscriber.rb b/activerecord/lib/active_record/log_subscriber.rb index 69371a1dab..61e5c120df 100644 --- a/activerecord/lib/active_record/log_subscriber.rb +++ b/activerecord/lib/active_record/log_subscriber.rb @@ -3,11 +3,11 @@ module ActiveRecord IGNORE_PAYLOAD_NAMES = ["SCHEMA", "EXPLAIN"] def self.runtime=(value) - ActiveRecord::RuntimeRegistry.instance.sql_runtime = value + ActiveRecord::RuntimeRegistry.sql_runtime = value end def self.runtime - ActiveRecord::RuntimeRegistry.instance.sql_runtime ||= 0 + ActiveRecord::RuntimeRegistry.sql_runtime ||= 0 end def self.reset_runtime |