From c79416a347d7abd6ba6b8e824d4a9edf2fd6d18d Mon Sep 17 00:00:00 2001 From: Sage Ross Date: Wed, 21 Jun 2017 10:12:18 -0700 Subject: Add more explicit guidance on how to fix callback deprecations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- activesupport/lib/active_support/callbacks.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'activesupport') 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 -- cgit v1.2.3