In this question is explained what to do to make a simple warning (but do not log trace so is not so useful) and there is a bunch of methods to make this, but I found no guides.
How do I use ActiveSupport::Deprecation to mark a old_method as deprecated and call other new_method.
As Roman says, it can be done with
ActiveSupport::Deprecation.deprecate_methods(target_module, *deprecated_methods)
where:
target_moduleis the module or class where the method belongs.deprecated_methodsis an array of symbols.In the last methods can be given options to customize the deprecation message.
This example shows the default message when old_method is called, give a comment to “use new_method instead“, in the second one, and the custom message with :another_old_method.
Notes: The deprecated methods should be defined (before) and will be executed. The :new_method is not called automatically. (there are more options, but I don’t know them)