add_on_blank(attributes, msg = @@default_error_messages[:blank])
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, msg = @@default_error_messages[:blank])
for attr in [attributes].flatten
value = @base.respond_to?(attr.to_s) ? @base.send(attr.to_s) : @base[attr.to_s]
add(attr, msg) if value.blank?
end
end