diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-23 20:32:09 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-23 20:32:09 -0300 |
commit | 7f7c09c1f353b1775899d448a00a4eb1330a780c (patch) | |
tree | 1040dc9cf8232c8461d99adec39f45e244d9e72e | |
parent | 7ab469c839d70ea9fbc74eb3bfe273037a91af69 (diff) | |
download | rails-7f7c09c1f353b1775899d448a00a4eb1330a780c.tar.gz rails-7f7c09c1f353b1775899d448a00a4eb1330a780c.tar.bz2 rails-7f7c09c1f353b1775899d448a00a4eb1330a780c.zip |
Remove warning of intance variable not initialized
-rw-r--r-- | activesupport/lib/active_support/core_ext/thread.rb | 6 |
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) |