Will add an error message to each of the attributes in
attributes that is blank (using Object#blank?).
# File activemodel/lib/active_model/errors.rb, line 209
def add_on_blank(attributes, options = {})
if options && !options.is_a?(Hash)
options = { :message => options }
ActiveSupport::Deprecation.warn \
"ActiveModel::Errors#add_on_blank(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)
add(attribute, :blank, options) if value.blank?
end
end