aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/association_basics.md
diff options
context:
space:
mode:
authorJosef Šimánek <josef.simanek@gmail.com>2015-02-14 03:24:54 +0100
committerJosef Šimánek <josef.simanek@gmail.com>2015-02-21 23:03:10 +0100
commit6576f7354e50afb79881aaf3a6f50f4e81dfab70 (patch)
tree9f53674c07731b069c0890fb26ab3d64b4207e8b /guides/source/association_basics.md
parentbab3c7c63deee86305d80e24c4ea1124c0ec27d1 (diff)
downloadrails-6576f7354e50afb79881aaf3a6f50f4e81dfab70.tar.gz
rails-6576f7354e50afb79881aaf3a6f50f4e81dfab70.tar.bz2
rails-6576f7354e50afb79881aaf3a6f50f4e81dfab70.zip
Require `belongs_to` by default.
Deprecate `required` option in favor of `optional` for belongs_to.
Diffstat (limited to 'guides/source/association_basics.md')
-rw-r--r--guides/source/association_basics.md5
1 files changed, 5 insertions, 0 deletions
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index cd715aba1f..0079049d44 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -833,6 +833,7 @@ The `belongs_to` association supports these options:
* `:polymorphic`
* `:touch`
* `:validate`
+* `:optional`
##### `:autosave`
@@ -956,6 +957,10 @@ end
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.
+##### `:optional`
+
+If you set the `:optional` option to `true`, then associated object will be validated for presence. By default, this is `false`: associated objects will be validated for presence.
+
#### Scopes for `belongs_to`
There may be times when you wish to customize the query used by `belongs_to`. Such customizations can be achieved via a scope block. For example: