class Rails::DeprecatedConstant

def self.deprecate(old, new)

def self.deprecate(old, new)
  constant = self.new(old, new)
  eval "::#{old} = constant"
end

def initialize(old, new)

def initialize(old, new)
  @old, @new = old, new
  @target = ::Kernel.eval "proc { #{@new} }"
  @warned = false
end

def method_missing(meth, *args, &block)

def method_missing(meth, *args, &block)
  ::ActiveSupport::Deprecation.warn("#{@old} is deprecated. Please use #{@new}") unless @warned
  @warned = true
  target = @target.call
  if target.respond_to?(meth)
    target.send(meth, *args, &block)
  else
    super
  end
end