method

add_on_empty

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_empty(attributes, options = {})
public

Will add an error message to each of the attributes in attributes that is empty.

person.errors.add_on_empty(:name)
person.errors.messages
# => {:name=>["can't be empty"]}