instance method add_on_blank

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

add_on_blank(attributes, custom_message = nil)

Will add an error message to each of the attributes in attributes that is blank (using Object#blank?).

Parameters

attributes req
custom_message opt = nil
Source
# File activerecord/lib/active_record/validations.rb, line 63
    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

Defined in activerecord/lib/active_record/validations.rb line 63 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Errors

Type at least 2 characters to search.

↑↓ navigate · open · esc close