method

add_on_blank

rails latest stable - Class: ActiveModel::Errors

Method deprecated or moved

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"]}