diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2015-12-18 12:02:47 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2015-12-18 12:02:47 +0100 |
commit | 33e11e59cce582c6b866df2e97477701c30cede1 (patch) | |
tree | f79c175f816b25b494a54f63c33293d50dec6d0e | |
parent | 13007e57ba74e35993e53a499837ed6fba6907c3 (diff) | |
download | rails-33e11e59cce582c6b866df2e97477701c30cede1.tar.gz rails-33e11e59cce582c6b866df2e97477701c30cede1.tar.bz2 rails-33e11e59cce582c6b866df2e97477701c30cede1.zip |
Revert "Use Thread.current.thread_variable_set/get insetad of the direct accessors"
This reverts commit 301f43820562c6a70dffe30f4227ff0751f47d4f per @matthewd on https://github.com/rails/rails/pull/22630/files#r47997074
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb b/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb index e02e965d75..e211772658 100644 --- a/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +++ b/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb @@ -40,14 +40,14 @@ class Module raise NameError.new("invalid attribute name: #{sym}") unless sym =~ /^[_A-Za-z]\w*$/ class_eval(<<-EOS, __FILE__, __LINE__ + 1) def self.#{sym} - Thread.current.thread_variable_get "attr_#{name}_#{sym}" + Thread.current[:"attr_#{name}_#{sym}"] end EOS unless options[:instance_reader] == false || options[:instance_accessor] == false class_eval(<<-EOS, __FILE__, __LINE__ + 1) def #{sym} - Thread.current.thread_variable_get "attr_#{self.class.name}_#{sym}" + Thread.current[:"attr_#{self.class.name}_#{sym}"] end EOS end @@ -79,14 +79,14 @@ class Module raise NameError.new("invalid attribute name: #{sym}") unless sym =~ /^[_A-Za-z]\w*$/ class_eval(<<-EOS, __FILE__, __LINE__ + 1) def self.#{sym}=(obj) - Thread.current.thread_variable_set "attr_#{name}_#{sym}", obj + Thread.current[:"attr_#{name}_#{sym}"] = obj end EOS unless options[:instance_writer] == false || options[:instance_accessor] == false class_eval(<<-EOS, __FILE__, __LINE__ + 1) def #{sym}=(obj) - Thread.current.thread_variable_set "attr_#{self.class.name}_#{sym}", obj + Thread.current[:"attr_#{self.class.name}_#{sym}"] = obj end EOS end |