deprecate_methods

deprecate_methods(target_module, *method_names)
Instance Public methods

Declare that a method has been deprecated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Fred
  extend self
 
  def foo; end
  def bar; end
  def baz; end
end
 
ActiveSupport::Deprecation.deprecate_methods(Fred, :foo, bar: :qux, baz: 'use Bar#baz instead')
# => [:foo, :bar, :baz]
 
Fred.foo
# => "DEPRECATION WARNING: foo is deprecated and will be removed from Rails 4.1."
 
Fred.bar
# => "DEPRECATION WARNING: bar is deprecated and will be removed from Rails 4.1 (use qux instead)."
 
Fred.baz
# => "DEPRECATION WARNING: baz is deprecated and will be removed from Rails 4.1 (use Bar#baz instead)."
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.