From 1a5394f4afdf2eeadd91b5b0ff5ad199c9dc93b0 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 2 Jul 2013 15:44:58 -0700 Subject: lock around mutating the generated methods module --- activerecord/lib/active_record/attribute_methods.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index ff93640814..5e990955ab 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -46,8 +46,10 @@ module ActiveRecord end def undefine_attribute_methods # :nodoc: - super if @attribute_methods_generated - @attribute_methods_generated = false + generated_attribute_methods.synchronize do + super if @attribute_methods_generated + @attribute_methods_generated = false + end end # Raises a ActiveRecord::DangerousAttributeError exception when an -- cgit v1.2.3