Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update how to clear the association cache #24344

Merged
merged 1 commit into from
Mar 28, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions guides/source/association_basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down