mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
revises references to :allow_(nil|blank) in some docs [ci skip] [Steven Yang & Xavier Noria]
Closes #11247.
This commit is contained in:
parent
61554efd02
commit
0df1f91410
10 changed files with 12 additions and 26 deletions
|
@ -126,8 +126,6 @@ module ActiveModel
|
|||
# Options:
|
||||
# * <tt>:on</tt> - Specifies the context where this validation is active
|
||||
# (e.g. <tt>on: :create</tt> or <tt>on: :custom_validation_context</tt>)
|
||||
# * <tt>:allow_nil</tt> - Skip validation if attribute is +nil+.
|
||||
# * <tt>:allow_blank</tt> - Skip validation if attribute is blank.
|
||||
# * <tt>:if</tt> - Specifies a method, proc or string to call to determine
|
||||
# if the validation should occur (e.g. <tt>if: :allow_validation</tt>,
|
||||
# or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method,
|
||||
|
|
|
@ -21,7 +21,7 @@ module ActiveModel
|
|||
# * <tt>:message</tt> - A custom error message (default is: "must be blank").
|
||||
#
|
||||
# There is also a list of default options supported by every validator:
|
||||
# +:if+, +:unless+, +:on+ and +:strict+.
|
||||
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
|
||||
# See <tt>ActiveModel::Validation#validates</tt> for more information
|
||||
def validates_absence_of(*attr_names)
|
||||
validates_with AbsenceValidator, _merge_attributes(attr_names)
|
||||
|
|
|
@ -38,8 +38,6 @@ module ActiveModel
|
|||
# Configuration options:
|
||||
# * <tt>:message</tt> - A custom error message (default is: "must be
|
||||
# accepted").
|
||||
# * <tt>:allow_nil</tt> - Skip validation if attribute is +nil+ (default
|
||||
# is +true+).
|
||||
# * <tt>:accept</tt> - Specifies value that is considered accepted.
|
||||
# The default value is a string "1", which makes it easy to relate to
|
||||
# an HTML checkbox. This should be set to +true+ if you are validating
|
||||
|
@ -47,8 +45,8 @@ module ActiveModel
|
|||
# before validation.
|
||||
#
|
||||
# There is also a list of default options supported by every validator:
|
||||
# +:if+, +:unless+, +:on+ and +:strict+.
|
||||
# See <tt>ActiveModel::Validation#validates</tt> for more information
|
||||
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
|
||||
# See <tt>ActiveModel::Validation#validates</tt> for more information.
|
||||
def validates_acceptance_of(*attr_names)
|
||||
validates_with AcceptanceValidator, _merge_attributes(attr_names)
|
||||
end
|
||||
|
|
|
@ -57,7 +57,7 @@ module ActiveModel
|
|||
# confirmation").
|
||||
#
|
||||
# There is also a list of default options supported by every validator:
|
||||
# +:if+, +:unless+, +:on+ and +:strict+.
|
||||
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
|
||||
# See <tt>ActiveModel::Validation#validates</tt> for more information
|
||||
def validates_confirmation_of(*attr_names)
|
||||
validates_with ConfirmationValidator, _merge_attributes(attr_names)
|
||||
|
|
|
@ -34,13 +34,9 @@ module ActiveModel
|
|||
# <tt>Range#cover?</tt>, otherwise with <tt>include?</tt>.
|
||||
# * <tt>:message</tt> - Specifies a custom error message (default is: "is
|
||||
# reserved").
|
||||
# * <tt>:allow_nil</tt> - If set to true, skips this validation if the
|
||||
# attribute is +nil+ (default is +false+).
|
||||
# * <tt>:allow_blank</tt> - If set to true, skips this validation if the
|
||||
# attribute is blank(default is +false+).
|
||||
#
|
||||
# There is also a list of default options supported by every validator:
|
||||
# +:if+, +:unless+, +:on+ and +:strict+.
|
||||
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
|
||||
# See <tt>ActiveModel::Validation#validates</tt> for more information
|
||||
def validates_exclusion_of(*attr_names)
|
||||
validates_with ExclusionValidator, _merge_attributes(attr_names)
|
||||
|
|
|
@ -91,10 +91,6 @@ module ActiveModel
|
|||
#
|
||||
# Configuration options:
|
||||
# * <tt>:message</tt> - A custom error message (default is: "is invalid").
|
||||
# * <tt>:allow_nil</tt> - If set to true, skips this validation if the
|
||||
# attribute is +nil+ (default is +false+).
|
||||
# * <tt>:allow_blank</tt> - If set to true, skips this validation if the
|
||||
# attribute is blank (default is +false+).
|
||||
# * <tt>:with</tt> - Regular expression that if the attribute matches will
|
||||
# result in a successful validation. This can be provided as a proc or
|
||||
# lambda returning regular expression which will be called at runtime.
|
||||
|
@ -107,7 +103,7 @@ module ActiveModel
|
|||
# beginning or end of the string. These anchors are <tt>^</tt> and <tt>$</tt>.
|
||||
#
|
||||
# There is also a list of default options supported by every validator:
|
||||
# +:if+, +:unless+, +:on+ and +:strict+.
|
||||
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
|
||||
# See <tt>ActiveModel::Validation#validates</tt> for more information
|
||||
def validates_format_of(*attr_names)
|
||||
validates_with FormatValidator, _merge_attributes(attr_names)
|
||||
|
|
|
@ -34,13 +34,9 @@ module ActiveModel
|
|||
# * <tt>:within</tt> - A synonym(or alias) for <tt>:in</tt>
|
||||
# * <tt>:message</tt> - Specifies a custom error message (default is: "is
|
||||
# not included in the list").
|
||||
# * <tt>:allow_nil</tt> - If set to +true+, skips this validation if the
|
||||
# attribute is +nil+ (default is +false+).
|
||||
# * <tt>:allow_blank</tt> - If set to +true+, skips this validation if the
|
||||
# attribute is blank (default is +false+).
|
||||
#
|
||||
# There is also a list of default options supported by every validator:
|
||||
# +:if+, +:unless+, +:on+ and +:strict+.
|
||||
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
|
||||
# See <tt>ActiveModel::Validation#validates</tt> for more information
|
||||
def validates_inclusion_of(*attr_names)
|
||||
validates_with InclusionValidator, _merge_attributes(attr_names)
|
||||
|
|
|
@ -110,7 +110,7 @@ module ActiveModel
|
|||
# * <tt>:even</tt> - Specifies the value must be an even number.
|
||||
#
|
||||
# There is also a list of default options supported by every validator:
|
||||
# +:if+, +:unless+, +:on+ and +:strict+ .
|
||||
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+ .
|
||||
# See <tt>ActiveModel::Validation#validates</tt> for more information
|
||||
#
|
||||
# The following checks can also be supplied with a proc or a symbol which
|
||||
|
|
|
@ -29,7 +29,7 @@ module ActiveModel
|
|||
# * <tt>:message</tt> - A custom error message (default is: "can't be blank").
|
||||
#
|
||||
# There is also a list of default options supported by every validator:
|
||||
# +:if+, +:unless+, +:on+ and +:strict+.
|
||||
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
|
||||
# See <tt>ActiveModel::Validation#validates</tt> for more information
|
||||
def validates_presence_of(*attr_names)
|
||||
validates_with PresenceValidator, _merge_attributes(attr_names)
|
||||
|
|
|
@ -83,7 +83,9 @@ module ActiveModel
|
|||
# or <tt>unless: Proc.new { |user| user.signup_step <= 2 }</tt>). The
|
||||
# method, proc or string should return or evaluate to a +true+ or
|
||||
# +false+ value.
|
||||
# * <tt>:strict</tt> - if the <tt>:strict</tt> option is set to true
|
||||
# * <tt>:allow_nil</tt> - Skip validation if the attribute is +nil+.
|
||||
# * <tt>:allow_blank</tt> - Skip validation if the attribute is blank.
|
||||
# * <tt>:strict</tt> - If the <tt>:strict</tt> option is set to true
|
||||
# will raise ActiveModel::StrictValidationFailed instead of adding the error.
|
||||
# <tt>:strict</tt> option can also be set to any other exception.
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue