aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2012-12-24 20:29:52 -0800
committerGuillermo Iguaran <guilleiguaran@gmail.com>2012-12-24 20:29:52 -0800
commit501175e3ad6d17913a4f97df21fc0b4f9568dcac (patch)
tree5d5fc8a30200735a579cc5e0b4da29e5fc34b00c /activesupport
parent0e4fb151ea7c2e0df29c588e4c79f76896891a1a (diff)
parent7f7c09c1f353b1775899d448a00a4eb1330a780c (diff)
downloadrails-501175e3ad6d17913a4f97df21fc0b4f9568dcac.tar.gz
rails-501175e3ad6d17913a4f97df21fc0b4f9568dcac.tar.bz2
rails-501175e3ad6d17913a4f97df21fc0b4f9568dcac.zip
Merge pull request #8592 from rafaelfranca/warning_fix
Remove warning of intance variable not initialized
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/thread.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/thread.rb b/activesupport/lib/active_support/core_ext/thread.rb
index 6ad0b2d69c..5481766f10 100644
--- a/activesupport/lib/active_support/core_ext/thread.rb
+++ b/activesupport/lib/active_support/core_ext/thread.rb
@@ -65,6 +65,10 @@ class Thread
private
def locals
- @locals || LOCK.synchronize { @locals ||= {} }
+ if defined?(@locals)
+ @locals
+ else
+ LOCK.synchronize { @locals ||= {} }
+ end
end
end unless Thread.instance_methods.include?(:thread_variable_set)