aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/callbacks.rb
diff options
context:
space:
mode:
authorSage Ross <ragesoss@gmail.com>2017-06-21 10:12:18 -0700
committerSage Ross <ragesoss@gmail.com>2017-06-23 07:41:47 -0700
commitc79416a347d7abd6ba6b8e824d4a9edf2fd6d18d (patch)
tree2920569f6664bb943cb67557e552686fdf4f54a3 /activesupport/lib/active_support/callbacks.rb
parentab0e4558816b1a69b4e96446ffe2812e21053b42 (diff)
downloadrails-c79416a347d7abd6ba6b8e824d4a9edf2fd6d18d.tar.gz
rails-c79416a347d7abd6ba6b8e824d4a9edf2fd6d18d.tar.bz2
rails-c79416a347d7abd6ba6b8e824d4a9edf2fd6d18d.zip
Add more explicit guidance on how to fix callback deprecations
This deprecation warning message will be more useful if it indicates what the string was doing — being eval'd — and what the non-deprecated options for callback conditionals are.
Diffstat (limited to 'activesupport/lib/active_support/callbacks.rb')
-rw-r--r--activesupport/lib/active_support/callbacks.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb
index ddfa91a342..aa33bd8889 100644
--- a/activesupport/lib/active_support/callbacks.rb
+++ b/activesupport/lib/active_support/callbacks.rb
@@ -662,8 +662,10 @@ module ActiveSupport
if options[:if].is_a?(String) || options[:unless].is_a?(String)
ActiveSupport::Deprecation.warn(<<-MSG.squish)
- Passing string to :if and :unless conditional options is deprecated
- and will be removed in Rails 5.2 without replacement.
+ Passing string to be evaluated in :if and :unless conditional
+ options is deprecated and will be removed in Rails 5.2 without
+ replacement. Pass a symbol for an instance method, or a lamdba,
+ proc or block, instead.
MSG
end