This method is deprecated or moved on the latest stable version.
The last existing version (v5.0.0.1) is shown here.
add_on_blank(attributes, options = {})
public
Will add an error message to each of the attributes in
attributes that is blank (using Object#blank?).
person.errors.add_on_blank(:name)person.errors.messages# => {:name=>["can't be blank"]}
# File activemodel/lib/active_model/errors.rb, line 369
def add_on_blank(attributes, options = {})
ActiveSupport::Deprecation.warn( ActiveModel::Errors#add_on_blank is deprecated and will be removed in Rails 5.1. To achieve the same use: errors.add(attribute, :empty, options) if value.blank?.squish)
Array(attributes).each do |attribute|
value = @base.send(:read_attribute_for_validation, attribute)
add(attribute, :blank, options) if value.blank?
end
end