vendor/rails/activerecord/lib/active_record/validations.rb
# Will add an error message to each of the attributes in +attributes+ that is empty.
Will add an error message to each of the attributes in +attributes+ that is empty.
Will add an error message to each of the attributes in + attributes + that is empty .
def add_on_empty(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]
        is_empty = value.respond_to?("empty?") ? value.empty? : false        
        add(attr, :empty, :default => custom_message) unless !value.nil? && !is_empty
      end
    end
def add_on_empty ( 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 ] is_empty = value . respond_to? ( "empty?" ) ? value . empty? : false add ( attr , :empty , :default => custom_message ) unless ! value . nil? && ! is_empty end end
Will add an error message to each of the attributes in +attributes+ that is empty.
Will add an error message to each of the attributes in + attributes + that is empty .
attributes
custom_message