def add_on_empty(attributes, options = {})
if options && !options.is_a?(Hash)
options = { :message => options }
ActiveSupport::Deprecation.warn \
"ActiveModel::Errors#add_on_empty(attributes, custom_message) has been deprecated.\n" +
"Instead of passing a custom_message pass an options Hash { :message => custom_message }."
end
[attributes].flatten.each do |attribute|
value = @base.send(:read_attribute_for_validation, attribute)
is_empty = value.respond_to?(:empty?) ? value.empty? : false
add(attribute, :empty, options) if value.nil? || is_empty
end
end