diff options
author | Vipul A M <vipulnsward@gmail.com> | 2016-03-28 19:36:22 +0530 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2016-03-28 19:36:22 +0530 |
commit | 3c29836d1d94c0303f23768d4f2f5d3e8aea03ab (patch) | |
tree | 69f67af744075d03330fa716551c9002fcb53004 | |
parent | 475109c517e724c015ee13061416568a7d6b9757 (diff) | |
parent | 53db086e6082b5fb277e4a497f6d11a616a778c8 (diff) | |
download | rails-3c29836d1d94c0303f23768d4f2f5d3e8aea03ab.tar.gz rails-3c29836d1d94c0303f23768d4f2f5d3e8aea03ab.tar.bz2 rails-3c29836d1d94c0303f23768d4f2f5d3e8aea03ab.zip |
Merge pull request #24344 from codeodor/patch-1
Update how to clear the association cache
-rw-r--r-- | guides/source/association_basics.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md index 67fd758fe1..4977d4f30e 100644 --- a/guides/source/association_basics.md +++ b/guides/source/association_basics.md @@ -545,12 +545,12 @@ author.books.size # uses the cached copy of books author.books.empty? # uses the cached copy of books ``` -But what if you want to reload the cache, because data might have been changed by some other part of the application? Just pass `true` to the association call: +But what if you want to reload the cache, because data might have been changed by some other part of the application? Just call `reload` on the association: ```ruby author.books # retrieves books from the database author.books.size # uses the cached copy of books -author.books(true).empty? # discards the cached copy of books +author.books.reload.empty? # discards the cached copy of books # and goes back to the database ``` |