diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG.md | 18 | ||||
-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 | ||||
-rw-r--r-- | activerecord/lib/active_record/runtime_registry.rb | 25 |
5 files changed, 20 insertions, 35 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index aa156f5d4f..062c548f20 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -6,11 +6,11 @@ Example: - cache = ActiveRecord::StatementCache.new do - Book.where(name: "my book").limit(100) - end + cache = ActiveRecord::StatementCache.new do + Book.where(name: "my book").limit(100) + end - books = cache.execute + books = cache.execute The solution attempts to get closer to the speed of `find_by_sql` but still maintaining the expressiveness of the Active Record queries. @@ -44,7 +44,6 @@ Ths solution is to build JoinAssociation when two relations with join information are being merged. And later while building the arel use the previously built `JoinAssociation` record in `JoinDependency#graft` to build the right from clause. - Fixes #3002. *Jared Armstrong and Neeraj Singh* @@ -76,7 +75,8 @@ *Michal Cichra* * `has_many` using `:through` now obeys the order clause mentioned in - through association. Fixes #10016. + through association. + Fixes #10016. *Neeraj Singh* @@ -141,7 +141,8 @@ *Ken Mazaika* * Add an `add_index` override in PostgreSQL adapter and MySQL adapter - to allow custom index type support. Fixes #6101. + to allow custom index type support. + Fixes #6101. add_index(:wikis, :body, :using => 'gin') @@ -165,7 +166,6 @@ in the association for a particular id. Then, it will go to the DB if it is not found. This is accomplished by calling `find_by_scan` in collection associations whenever `options[:inverse_of]` is not nil. - Fixes #9470. *John Wang* @@ -1275,7 +1275,7 @@ * Explain only normal CRUD sql (select / update / insert / delete). Fix problem that explains unexplainable sql. - Closes #7544 #6458. + Fixes #7544 #6458. *kennyj* 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 diff --git a/activerecord/lib/active_record/runtime_registry.rb b/activerecord/lib/active_record/runtime_registry.rb index 3f0ac68143..17890dd29f 100644 --- a/activerecord/lib/active_record/runtime_registry.rb +++ b/activerecord/lib/active_record/runtime_registry.rb @@ -1,29 +1,14 @@ require 'active_support/per_thread_registry' module ActiveRecord - # This is a registry class for storing local variables in active record. The - # class allows you to access variables that are local to the current thread. - # These thread local variables are stored as attributes in the - # +RuntimeRegistry+ class. - # - # You can access the thread local variables by calling a variable's name on - # the +RuntimeRegistry+ class. For example, if you wanted to obtain the - # connection handler for the current thread, you would invoke: - # - # ActiveRecord::RuntimeRegistry.instance.connection_handler - # - # The +PerThreadRegistry+ module will make a new +RuntimeRegistry+ instance - # and store it in +Thread.current+. Whenever you make a call for an attribute - # on the +RuntimeRegistry+ class, the call will be sent to the instance that - # is stored in +Thread.current+. - # - # Note that you can also make the following call which would provide an - # equivalent result as the previous code: + # This is a thread locals registry for Active Record. For example # # ActiveRecord::RuntimeRegistry.connection_handler # - # However, this is less performant because it makes a call to +method_missing+ - # before it sends the method call to the +instance+. + # returns the connection handler local to the current thread. + # + # See the documentation of <tt>ActiveSupport::PerThreadRegistry</tt> + # for further details. class RuntimeRegistry extend ActiveSupport::PerThreadRegistry |