Skip to content

Commit 97f0c3c

Browse files
authored
Merge pull request rails#47850 from notapatch/api-docs-activerecord-validate-multiple-contexts
Add docs for Active Record validation with multiple contexts
2 parents a40e934 + 5b25375 commit 97f0c3c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

activerecord/lib/active_record/validations.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def save!(**options)
6262
#
6363
# If the argument is +false+ (default is +nil+), the context is set to <tt>:create</tt> if
6464
# {new_record?}[rdoc-ref:Persistence#new_record?] is +true+, and to <tt>:update</tt> if it is not.
65+
# If the argument is an array of contexts, <tt>post.valid?([:create, :update])</tt>, the validations are
66+
# run within multiple contexts.
6567
#
6668
# \Validations with no <tt>:on</tt> option will run no matter the context. \Validations with
6769
# some <tt>:on</tt> option will only run in the specified context.

0 commit comments

Comments
 (0)