Skip to content
This repository
Browse code

Merge pull request #8592 from rafaelfranca/warning_fix

Remove warning of intance variable not initialized
  • Loading branch information...
commit 501175e3ad6d17913a4f97df21fc0b4f9568dcac 2 parents 0e4fb15 + 7f7c09c
Guillermo Iguaran guilleiguaran authored

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. +5 1 activesupport/lib/active_support/core_ext/thread.rb
6 activesupport/lib/active_support/core_ext/thread.rb
@@ -65,6 +65,10 @@ def thread_variable?(key)
65 65 private
66 66
67 67 def locals
68   - @locals || LOCK.synchronize { @locals ||= {} }
  68 + if defined?(@locals)
  69 + @locals
  70 + else
  71 + LOCK.synchronize { @locals ||= {} }
  72 + end
69 73 end
70 74 end unless Thread.instance_methods.include?(:thread_variable_set)

0 comments on commit 501175e

Please sign in to comment.
Something went wrong with that request. Please try again.