diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-01-31 08:41:51 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-01-31 08:41:51 +0000 |
commit | 0bfc504d9ced49d50afa7a8b19680ae7f42c2b24 (patch) | |
tree | f8fb46f779285f50c437715e2fb694f16bd3cad9 /activerecord/lib | |
parent | c472843bbc498fc0a21cb883c3929e191e061b3c (diff) | |
download | rails-0bfc504d9ced49d50afa7a8b19680ae7f42c2b24.tar.gz rails-0bfc504d9ced49d50afa7a8b19680ae7f42c2b24.tar.bz2 rails-0bfc504d9ced49d50afa7a8b19680ae7f42c2b24.zip |
Add workaround and deprecation if the inherited hook is not executed. Closes #4757.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index f3200aa78a..399c22fb18 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -36,6 +36,18 @@ module ActiveRecord # Generates all the attribute related methods for columns in the database # accessors, mutators and query methods. def define_attribute_methods + unless defined?(@attribute_methods_mutex) + ActiveSupport::Deprecation.warn( + "It looks like something (probably a gem/plugin) is removing or overriding the " \ + "ActiveRecord::Base.inherited method. It is important that this hook executes so " \ + "that your models are set up correctly. A workaround has been added to stop this " \ + "causing an error in 3.2, but future versions will simply not work if the hook is " \ + "overridden." + ) + + @attribute_methods_mutex = Mutex.new + end + # Use a mutex; we don't want two thread simaltaneously trying to define # attribute methods. @attribute_methods_mutex.synchronize do |