2012-01-18 18:20:32 -05:00
|
|
|
require 'active_support/deprecation/proxy_wrappers'
|
2012-01-17 11:53:09 -05:00
|
|
|
|
|
|
|
module Rails
|
2012-01-18 18:20:32 -05:00
|
|
|
class DeprecatedConstant < ActiveSupport::Deprecation::DeprecatedConstantProxy
|
|
|
|
def self.deprecate(old, current)
|
2012-09-18 09:53:36 -04:00
|
|
|
# double assignment is used to avoid "assigned but unused variable" warning
|
|
|
|
constant = constant = new(old, current)
|
2012-01-17 11:53:09 -05:00
|
|
|
eval "::#{old} = constant"
|
|
|
|
end
|
|
|
|
|
2012-01-18 18:20:32 -05:00
|
|
|
private
|
2012-01-17 11:53:09 -05:00
|
|
|
|
2012-01-18 18:20:32 -05:00
|
|
|
def target
|
|
|
|
::Kernel.eval @new_const.to_s
|
2012-01-17 11:53:09 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-01-18 18:20:32 -05:00
|
|
|
DeprecatedConstant.deprecate('RAILS_CACHE', '::Rails.cache')
|
2012-01-17 11:53:09 -05:00
|
|
|
end
|