mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
deprecation_method_warning and deprecation_horizon - fewer moving parts, easy to localize
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5161 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
0b61be4666
commit
7554518665
1 changed files with 9 additions and 1 deletions
|
@ -75,13 +75,21 @@ module ActiveSupport
|
|||
alias_method_chain(method_name, :deprecation) do |target, punctuation|
|
||||
class_eval(<<-EOS, __FILE__, __LINE__)
|
||||
def #{target}_with_deprecation#{punctuation}(*args, &block)
|
||||
::ActiveSupport::Deprecation.warn("#{method_name} is deprecated and will be removed from Rails 2.0", caller)
|
||||
::ActiveSupport::Deprecation.warn(self.class.deprecated_method_warning(:#{method_name}), caller)
|
||||
#{target}_without_deprecation#{punctuation}(*args, &block)
|
||||
end
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def deprecated_method_warning(method_name)
|
||||
"#{method_name} is deprecated and will be removed from Rails #{deprecation_horizon}"
|
||||
end
|
||||
|
||||
def deprecation_horizon
|
||||
'2.0'
|
||||
end
|
||||
end
|
||||
|
||||
module Assertions
|
||||
|
|
Loading…
Reference in a new issue