1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Specifiy association :validate option only applies to new associated objects

Per [code comments](6daa2d8315/activerecord/lib/active_record/associations.rb (L1418-L1420)), the `:validate` option only makes a difference for *new* objects. Existing objects are not validated, regardless of the setting.
This commit is contained in:
Jason Barnabe 2021-03-25 15:04:45 -05:00 committed by GitHub
parent 6daa2d8315
commit 345384fb1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1092,7 +1092,7 @@ end
##### `:validate`
If you set the `:validate` option to `true`, then associated objects will be validated whenever you save this object. By default, this is `false`: associated objects will not be validated when this object is saved.
If you set the `:validate` option to `true`, then new associated objects will be validated whenever you save this object. By default, this is `false`: new associated objects will not be validated when this object is saved.
##### `:optional`
@ -1412,7 +1412,7 @@ end
##### `:validate`
If you set the `:validate` option to `true`, then associated objects will be validated whenever you save this object. By default, this is `false`: associated objects will not be validated when this object is saved.
If you set the `:validate` option to `true`, then new associated objects will be validated whenever you save this object. By default, this is `false`: new associated objects will not be validated when this object is saved.
#### Scopes for `has_one`
@ -1851,7 +1851,7 @@ The `:through` option specifies a join model through which to perform the query.
##### `:validate`
If you set the `:validate` option to `false`, then associated objects will not be validated whenever you save this object. By default, this is `true`: associated objects will be validated when this object is saved.
If you set the `:validate` option to `false`, then new associated objects will not be validated whenever you save this object. By default, this is `true`: new associated objects will be validated when this object is saved.
#### Scopes for `has_many`