module ActiveModelSerializers::Deprecate
def deprecate(name, replacement)
def deprecate(name, replacement) old = "_deprecated_#{name}" alias_method old, name class_eval do define_method(name) do |*args, &block| target = is_a?(Module) ? "#{self}." : "#{self.class}#" msg = ["NOTE: #{target}#{name} is deprecated", replacement == :none ? ' with no replacement' : "; use #{replacement} instead", "\n#{target}#{name} called from #{ActiveModelSerializers.location_of_caller.join(':')}"] warn "#{msg.join}." send old, *args, &block end end end