add_on_blank(attributes, custom_message = nil)
public
Will add an error message to
each of the attributes in
attributes that is blank (using Object#blank?).
Show source
def add_on_blank(attributes, custom_message = nil)
for attr in [attributes].flatten
value = @base.respond_to?(attr.to_s) ? @base.send(attr.to_s) : @base[attr.to_s]
add(attr, :blank, :default => custom_message) if value.blank?
end
end