aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/attribute_methods
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:31:41 +0000
commitfab664a8e9c94d7e3c52fed70ea2c0f569d142fb (patch)
tree9f87d7210c4054531138dd270ab4328680a80b3c /activerecord/test/cases/attribute_methods
parentf36dcaf488b4357a52f43e3912628428956d351f (diff)
downloadrails-fab664a8e9c94d7e3c52fed70ea2c0f569d142fb.tar.gz
rails-fab664a8e9c94d7e3c52fed70ea2c0f569d142fb.tar.bz2
rails-fab664a8e9c94d7e3c52fed70ea2c0f569d142fb.zip
Fix another race condition.
From 2c667f69aa2daac5ee6c29ca9679616e2a71532a. Thanks @pwnall for the heads-up. Conflicts: activerecord/lib/active_record/core.rb
Diffstat (limited to 'activerecord/test/cases/attribute_methods')
-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 7665f1c12e..6562041e9b 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
@@ -19,6 +20,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