提交 c79416a3 编写于 作者: S Sage Ross

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.
上级 ab0e4558
......@@ -662,8 +662,10 @@ def set_callback(name, *filter_list, &block)
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册