module ActiveModel::Validations::HelperMethods
def validates_absence_of(*attr_names)
+:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
There is also a list of default options supported by every validator:
* :message - A custom error message (default is: "must be blank").
Configuration options:
The first_name attribute must be in the object and it must be blank.
end
validates_absence_of :first_name
class Person < ActiveRecord::Base
Object#blank?). Happens by default on save.
Validates that the specified attributes are blank (as defined by
def validates_absence_of(*attr_names) validates_with AbsenceValidator, _merge_attributes(attr_names) end