aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-01-31 20:26:16 +0000
committerJon Leighton <j@jonathanleighton.com>2012-01-31 20:26:16 +0000
commite1de54079b2237c4ecbf7511ab5411e5517c272b (patch)
tree99f1a6d0c53d863a17e93c85e3e9e058e58647a2 /activerecord/lib
parent81f14a5433cbba3e7a6088156d9c548bc5c252ea (diff)
downloadrails-e1de54079b2237c4ecbf7511ab5411e5517c272b.tar.gz
rails-e1de54079b2237c4ecbf7511ab5411e5517c272b.tar.bz2
rails-e1de54079b2237c4ecbf7511ab5411e5517c272b.zip
Improve deprecation message
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/attribute_methods.rb24
1 files changed, 17 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb
index 399c22fb18..0dbc737de0 100644
--- a/activerecord/lib/active_record/attribute_methods.rb
+++ b/activerecord/lib/active_record/attribute_methods.rb
@@ -37,13 +37,23 @@ module ActiveRecord
# 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."
- )
+ msg = "It looks like something (probably a gem/plugin) is 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. If you are using Kaminari, please upgrade as it is known to have had " \
+ "this problem.\n\n"
+ msg << "The following may help track down the problem:"
+
+ meth = method(:inherited)
+ if meth.respond_to?(:source_location)
+ msg << " #{meth.source_location.inspect}"
+ else
+ msg << " #{meth.inspect}"
+ end
+ msg << "\n\n"
+
+ ActiveSupport::Deprecation.warn(msg)
@attribute_methods_mutex = Mutex.new
end