aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorJulia López <julialopez@gmail.com>2017-08-07 16:49:00 -0400
committerJulia López <julialopez@gmail.com>2017-08-07 17:01:48 -0400
commitf2810f1dab649b2999fa0ad991ddabb416c5be74 (patch)
treeca914d69c0ab2ec958b96daf6260b12123ce8aa2 /guides
parent7c89948c416fbc32b59e33a0ab454545b4f6fed7 (diff)
downloadrails-f2810f1dab649b2999fa0ad991ddabb416c5be74.tar.gz
rails-f2810f1dab649b2999fa0ad991ddabb416c5be74.tar.bz2
rails-f2810f1dab649b2999fa0ad991ddabb416c5be74.zip
add reload_association to documentation [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/association_basics.md10
1 files changed, 6 insertions, 4 deletions
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index bead931529..44228de591 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -811,6 +811,7 @@ When you declare a `belongs_to` association, the declaring class automatically g
* `build_association(attributes = {})`
* `create_association(attributes = {})`
* `create_association!(attributes = {})`
+* `reload_association`
In all of these methods, `association` is replaced with the symbol passed as the first argument to `belongs_to`. For example, given the declaration:
@@ -840,10 +841,10 @@ The `association` method returns the associated object, if any. If no associated
@author = @book.author
```
-If the associated object has already been retrieved from the database for this object, the cached version will be returned. To override this behavior (and force a database read), call `#reload` on the parent object.
+If the associated object has already been retrieved from the database for this object, the cached version will be returned. To override this behavior (and force a database read), call `#reload_association` on the parent object.
```ruby
-@author = @book.reload.author
+@author = @book.reload_author
```
##### `association=(associate)`
@@ -1161,6 +1162,7 @@ When you declare a `has_one` association, the declaring class automatically gain
* `build_association(attributes = {})`
* `create_association(attributes = {})`
* `create_association!(attributes = {})`
+* `reload_association`
In all of these methods, `association` is replaced with the symbol passed as the first argument to `has_one`. For example, given the declaration:
@@ -1190,10 +1192,10 @@ The `association` method returns the associated object, if any. If no associated
@account = @supplier.account
```
-If the associated object has already been retrieved from the database for this object, the cached version will be returned. To override this behavior (and force a database read), call `#reload` on the parent object.
+If the associated object has already been retrieved from the database for this object, the cached version will be returned. To override this behavior (and force a database read), call `#reload_association` on the parent object.
```ruby
-@account = @supplier.reload.account
+@account = @supplier.reload_account
```
##### `association=(associate)`