Rails 4.1.8 Ruby 2.2.0p0
module Fred
extend self
def aaa; end
def bbb; end
def ccc; end
def ddd; end
def eee; end
end
module Bar
extend self
def ccc; end
end
ActiveSupport::Deprecation.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead')
Fred.aaa
DEPRECATION WARNING: aaa is deprecated and will be removed from Rails 4.2. (called from __pry__ at (pry):15)
=> nil
Тот же код пробовал в рельсах 5.2.0, но не ПРЕДУПРЕЖДЕНИЕ ОБ УСТРОЙСТВЕ .
Rails 5.2.0 Ruby 2.5.1p57
class Fred
def aaa; end
def bbb; end
def ccc; end
def ddd; end
def eee; end
end
class Bar
def ccc; end
end
ActiveSupport::Deprecation.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead')
> Fred.new.aaa
DEPRECATION WARNING: aaa is deprecated and will be removed from Rails 6.0 (called from irb_binding at (irb):13)
=> nil