From 345384fb1fdba1658eff715d5e4dda8902e9e8ad Mon Sep 17 00:00:00 2001 From: Jason Barnabe Date: Thu, 25 Mar 2021 15:04:45 -0500 Subject: [PATCH] Specifiy association :validate option only applies to new associated objects Per [code comments](https://github.com/rails/rails/blob/6daa2d8315c29639ad75f01b8b14a60534a0a183/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. --- guides/source/association_basics.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md index 556843865d..1a2592f69e 100644 --- a/guides/source/association_basics.md +++ b/guides/source/association_basics.md @@ -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`