Permalink
Browse files

Remove warning of intance variable not initialized

  • Loading branch information...
rafaelfranca committed Dec 23, 2012
1 parent 7ab469c commit 7f7c09c1f353b1775899d448a00a4eb1330a780c
Showing with 5 additions and 1 deletion.
  1. +5 −1 activesupport/lib/active_support/core_ext/thread.rb
@@ -65,6 +65,10 @@ def thread_variable?(key)
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)

0 comments on commit 7f7c09c

Please sign in to comment.