diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index 718fc78605..1116f6b8ee 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -68,8 +68,9 @@ module ActiveModel # # Options: # * :on - Specifies the contexts where this validation is active. - # You can pass a symbol or an array of symbols. - # (e.g. on: :create or on: :custom_validation_context or + # Runs in all validation contexts by default (nil). You can pass a symbol + # or an array of symbols. (e.g. on: :create or + # on: :custom_validation_context or # on: [:create, :custom_validation_context]) # * :allow_nil - Skip validation if attribute is +nil+. # * :allow_blank - Skip validation if attribute is blank. @@ -130,8 +131,9 @@ module ActiveModel # # Options: # * :on - Specifies the contexts where this validation is active. - # You can pass a symbol or an array of symbols. - # (e.g. on: :create or on: :custom_validation_context or + # Runs in all validation contexts by default (nil). You can pass a symbol + # or an array of symbols. (e.g. on: :create or + # on: :custom_validation_context or # on: [:create, :custom_validation_context]) # * :if - Specifies a method, proc or string to call to determine # if the validation should occur (e.g. if: :allow_validation, diff --git a/activemodel/lib/active_model/validations/validates.rb b/activemodel/lib/active_model/validations/validates.rb index ae8d377fdf..bda436d8d0 100644 --- a/activemodel/lib/active_model/validations/validates.rb +++ b/activemodel/lib/active_model/validations/validates.rb @@ -71,9 +71,11 @@ module ActiveModel # # There is also a list of options that could be used along with validators: # - # * :on - Specifies when this validation is active. Runs in all - # validation contexts by default (+nil+), other options are :create - # and :update. + # * :on - Specifies the contexts where this validation is active. + # Runs in all validation contexts by default (nil). You can pass a symbol + # or an array of symbols. (e.g. on: :create or + # on: :custom_validation_context or + # on: [:create, :custom_validation_context]) # * :if - Specifies a method, proc or string to call to determine # if the validation should occur (e.g. if: :allow_validation, # or if: Proc.new { |user| user.signup_step > 2 }). The method, diff --git a/activemodel/lib/active_model/validations/with.rb b/activemodel/lib/active_model/validations/with.rb index ff41572105..a2531327bf 100644 --- a/activemodel/lib/active_model/validations/with.rb +++ b/activemodel/lib/active_model/validations/with.rb @@ -52,8 +52,11 @@ module ActiveModel # end # # Configuration options: - # * :on - Specifies when this validation is active - # (:create or :update). + # * :on - Specifies the contexts where this validation is active. + # Runs in all validation contexts by default (nil). You can pass a symbol + # or an array of symbols. (e.g. on: :create or + # on: :custom_validation_context or + # on: [:create, :custom_validation_context]) # * :if - Specifies a method, proc or string to call to determine # if the validation should occur (e.g. if: :allow_validation, # or if: Proc.new { |user| user.signup_step > 2 }). diff --git a/activerecord/lib/active_record/validations/associated.rb b/activerecord/lib/active_record/validations/associated.rb index b4785d3ba4..47ccef31a5 100644 --- a/activerecord/lib/active_record/validations/associated.rb +++ b/activerecord/lib/active_record/validations/associated.rb @@ -29,9 +29,11 @@ module ActiveRecord # Configuration options: # # * :message - A custom error message (default is: "is invalid"). - # * :on - Specifies when this validation is active. Runs in all - # validation contexts by default (+nil+), other options are :create - # and :update. + # * :on - Specifies the contexts where this validation is active. + # Runs in all validation contexts by default (nil). You can pass a symbol + # or an array of symbols. (e.g. on: :create or + # on: :custom_validation_context or + # on: [:create, :custom_validation_context]) # * :if - Specifies a method, proc or string to call to determine # if the validation should occur (e.g. if: :allow_validation, # or if: Proc.new { |user| user.signup_step > 2 }). The method, diff --git a/activerecord/lib/active_record/validations/presence.rb b/activerecord/lib/active_record/validations/presence.rb index e586744818..c7aa814ba8 100644 --- a/activerecord/lib/active_record/validations/presence.rb +++ b/activerecord/lib/active_record/validations/presence.rb @@ -44,9 +44,11 @@ module ActiveRecord # # Configuration options: # * :message - A custom error message (default is: "can't be blank"). - # * :on - Specifies when this validation is active. Runs in all - # validation contexts by default (+nil+), other options are :create - # and :update. + # * :on - Specifies the contexts where this validation is active. + # Runs in all validation contexts by default (nil). You can pass a symbol + # or an array of symbols. (e.g. on: :create or + # on: :custom_validation_context or + # on: [:create, :custom_validation_context]) # * :if - Specifies a method, proc or string to call to determine if # the validation should occur (e.g. if: :allow_validation, or # if: Proc.new { |user| user.signup_step > 2 }). The method, proc