aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-01-20 18:17:36 +0000
committerJon Leighton <j@jonathanleighton.com>2012-01-20 18:32:27 +0000
commit30b0e5848c5a91c0bfd1ef33ec4b9bc36bcead0b (patch)
tree2e8b9f966ce39701ee3b2d1905209acec1f0cc85 /activerecord/test
parentde41f5a9799cbce276ca9c439c99f4377191b36d (diff)
downloadrails-30b0e5848c5a91c0bfd1ef33ec4b9bc36bcead0b.tar.gz
rails-30b0e5848c5a91c0bfd1ef33ec4b9bc36bcead0b.tar.bz2
rails-30b0e5848c5a91c0bfd1ef33ec4b9bc36bcead0b.zip
Fix another race condition.
From 2c667f69aa2daac5ee6c29ca9679616e2a71532a. Thanks @pwnall for the heads-up.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/attribute_methods/read_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/attribute_methods/read_test.rb b/activerecord/test/cases/attribute_methods/read_test.rb
index 0df9ffc0c5..764305459d 100644
--- a/activerecord/test/cases/attribute_methods/read_test.rb
+++ b/activerecord/test/cases/attribute_methods/read_test.rb
@@ -1,5 +1,6 @@
require "cases/helper"
require 'active_support/core_ext/object/inclusion'
+require 'thread'
module ActiveRecord
module AttributeMethods
@@ -20,6 +21,13 @@ module ActiveRecord
include ActiveRecord::AttributeMethods
+ def self.define_attribute_methods
+ # Created in the inherited/included hook for "proper" ARs
+ @attribute_methods_mutex ||= Mutex.new
+
+ super
+ end
+
def self.column_names
%w{ one two three }
end