Skip to content

Commit 0df1f91

Browse files
committed
revises references to :allow_(nil|blank) in some docs [ci skip] [Steven Yang & Xavier Noria]
Closes rails#11247.
1 parent 61554ef commit 0df1f91

File tree

10 files changed

+12
-26
lines changed

10 files changed

+12
-26
lines changed

activemodel/lib/active_model/validations.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ def validates_each(*attr_names, &block)
126126
# Options:
127127
# * <tt>:on</tt> - Specifies the context where this validation is active
128128
# (e.g. <tt>on: :create</tt> or <tt>on: :custom_validation_context</tt>)
129-
# * <tt>:allow_nil</tt> - Skip validation if attribute is +nil+.
130-
# * <tt>:allow_blank</tt> - Skip validation if attribute is blank.
131129
# * <tt>:if</tt> - Specifies a method, proc or string to call to determine
132130
# if the validation should occur (e.g. <tt>if: :allow_validation</tt>,
133131
# or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method,

activemodel/lib/active_model/validations/absence.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module HelperMethods
2121
# * <tt>:message</tt> - A custom error message (default is: "must be blank").
2222
#
2323
# There is also a list of default options supported by every validator:
24-
# +:if+, +:unless+, +:on+ and +:strict+.
24+
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
2525
# See <tt>ActiveModel::Validation#validates</tt> for more information
2626
def validates_absence_of(*attr_names)
2727
validates_with AbsenceValidator, _merge_attributes(attr_names)

activemodel/lib/active_model/validations/acceptance.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,15 @@ module HelperMethods
3838
# Configuration options:
3939
# * <tt>:message</tt> - A custom error message (default is: "must be
4040
# accepted").
41-
# * <tt>:allow_nil</tt> - Skip validation if attribute is +nil+ (default
42-
# is +true+).
4341
# * <tt>:accept</tt> - Specifies value that is considered accepted.
4442
# The default value is a string "1", which makes it easy to relate to
4543
# an HTML checkbox. This should be set to +true+ if you are validating
4644
# a database column, since the attribute is typecast from "1" to +true+
4745
# before validation.
4846
#
4947
# There is also a list of default options supported by every validator:
50-
# +:if+, +:unless+, +:on+ and +:strict+.
51-
# See <tt>ActiveModel::Validation#validates</tt> for more information
48+
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
49+
# See <tt>ActiveModel::Validation#validates</tt> for more information.
5250
def validates_acceptance_of(*attr_names)
5351
validates_with AcceptanceValidator, _merge_attributes(attr_names)
5452
end

activemodel/lib/active_model/validations/confirmation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module HelperMethods
5757
# confirmation").
5858
#
5959
# There is also a list of default options supported by every validator:
60-
# +:if+, +:unless+, +:on+ and +:strict+.
60+
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
6161
# See <tt>ActiveModel::Validation#validates</tt> for more information
6262
def validates_confirmation_of(*attr_names)
6363
validates_with ConfirmationValidator, _merge_attributes(attr_names)

activemodel/lib/active_model/validations/exclusion.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,9 @@ module HelperMethods
3434
# <tt>Range#cover?</tt>, otherwise with <tt>include?</tt>.
3535
# * <tt>:message</tt> - Specifies a custom error message (default is: "is
3636
# reserved").
37-
# * <tt>:allow_nil</tt> - If set to true, skips this validation if the
38-
# attribute is +nil+ (default is +false+).
39-
# * <tt>:allow_blank</tt> - If set to true, skips this validation if the
40-
# attribute is blank(default is +false+).
4137
#
4238
# There is also a list of default options supported by every validator:
43-
# +:if+, +:unless+, +:on+ and +:strict+.
39+
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
4440
# See <tt>ActiveModel::Validation#validates</tt> for more information
4541
def validates_exclusion_of(*attr_names)
4642
validates_with ExclusionValidator, _merge_attributes(attr_names)

activemodel/lib/active_model/validations/format.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ module HelperMethods
9191
#
9292
# Configuration options:
9393
# * <tt>:message</tt> - A custom error message (default is: "is invalid").
94-
# * <tt>:allow_nil</tt> - If set to true, skips this validation if the
95-
# attribute is +nil+ (default is +false+).
96-
# * <tt>:allow_blank</tt> - If set to true, skips this validation if the
97-
# attribute is blank (default is +false+).
9894
# * <tt>:with</tt> - Regular expression that if the attribute matches will
9995
# result in a successful validation. This can be provided as a proc or
10096
# lambda returning regular expression which will be called at runtime.
@@ -107,7 +103,7 @@ module HelperMethods
107103
# beginning or end of the string. These anchors are <tt>^</tt> and <tt>$</tt>.
108104
#
109105
# There is also a list of default options supported by every validator:
110-
# +:if+, +:unless+, +:on+ and +:strict+.
106+
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
111107
# See <tt>ActiveModel::Validation#validates</tt> for more information
112108
def validates_format_of(*attr_names)
113109
validates_with FormatValidator, _merge_attributes(attr_names)

activemodel/lib/active_model/validations/inclusion.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,9 @@ module HelperMethods
3434
# * <tt>:within</tt> - A synonym(or alias) for <tt>:in</tt>
3535
# * <tt>:message</tt> - Specifies a custom error message (default is: "is
3636
# not included in the list").
37-
# * <tt>:allow_nil</tt> - If set to +true+, skips this validation if the
38-
# attribute is +nil+ (default is +false+).
39-
# * <tt>:allow_blank</tt> - If set to +true+, skips this validation if the
40-
# attribute is blank (default is +false+).
4137
#
4238
# There is also a list of default options supported by every validator:
43-
# +:if+, +:unless+, +:on+ and +:strict+.
39+
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
4440
# See <tt>ActiveModel::Validation#validates</tt> for more information
4541
def validates_inclusion_of(*attr_names)
4642
validates_with InclusionValidator, _merge_attributes(attr_names)

activemodel/lib/active_model/validations/numericality.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ module HelperMethods
110110
# * <tt>:even</tt> - Specifies the value must be an even number.
111111
#
112112
# There is also a list of default options supported by every validator:
113-
# +:if+, +:unless+, +:on+ and +:strict+ .
113+
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+ .
114114
# See <tt>ActiveModel::Validation#validates</tt> for more information
115115
#
116116
# The following checks can also be supplied with a proc or a symbol which

activemodel/lib/active_model/validations/presence.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module HelperMethods
2929
# * <tt>:message</tt> - A custom error message (default is: "can't be blank").
3030
#
3131
# There is also a list of default options supported by every validator:
32-
# +:if+, +:unless+, +:on+ and +:strict+.
32+
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
3333
# See <tt>ActiveModel::Validation#validates</tt> for more information
3434
def validates_presence_of(*attr_names)
3535
validates_with PresenceValidator, _merge_attributes(attr_names)

activemodel/lib/active_model/validations/validates.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ module ClassMethods
8383
# or <tt>unless: Proc.new { |user| user.signup_step <= 2 }</tt>). The
8484
# method, proc or string should return or evaluate to a +true+ or
8585
# +false+ value.
86-
# * <tt>:strict</tt> - if the <tt>:strict</tt> option is set to true
86+
# * <tt>:allow_nil</tt> - Skip validation if the attribute is +nil+.
87+
# * <tt>:allow_blank</tt> - Skip validation if the attribute is blank.
88+
# * <tt>:strict</tt> - If the <tt>:strict</tt> option is set to true
8789
# will raise ActiveModel::StrictValidationFailed instead of adding the error.
8890
# <tt>:strict</tt> option can also be set to any other exception.
8991
#

0 commit comments

Comments
 (0)