aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/caching_with_rails.md
diff options
context:
space:
mode:
authorGenadi Samokovarov <gsamokovarov@gmail.com>2015-12-17 11:30:30 +0100
committerGenadi Samokovarov <gsamokovarov@gmail.com>2015-12-17 11:56:35 +0100
commitc29fbd3c7aa6391e820f682a960968aab7a52d07 (patch)
tree9a7bb5f8e6345321e5ff2eba809b4f5ab9da9c1a /guides/source/caching_with_rails.md
parentc4f8ce53b1f9af9585aeec9bbb0c66fc9c48ec1b (diff)
downloadrails-c29fbd3c7aa6391e820f682a960968aab7a52d07.tar.gz
rails-c29fbd3c7aa6391e820f682a960968aab7a52d07.tar.bz2
rails-c29fbd3c7aa6391e820f682a960968aab7a52d07.zip
ApplicationRecord documentation pass
This is a pass over the documentation which fills the missing gaps of `ApplicationRecord`. [ci skip]
Diffstat (limited to 'guides/source/caching_with_rails.md')
-rw-r--r--guides/source/caching_with_rails.md6
1 files changed, 3 insertions, 3 deletions
diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md
index 9a56233e4a..3a1a1ccfe6 100644
--- a/guides/source/caching_with_rails.md
+++ b/guides/source/caching_with_rails.md
@@ -175,11 +175,11 @@ your app will serve stale data. To fix this, we tie the models together with
the `touch` method:
```ruby
-class Product < ActiveRecord::Base
+class Product < ApplicationRecord
has_many :games
end
-class Game < ActiveRecord::Base
+class Game < ApplicationRecord
belongs_to :product, touch: true
end
```
@@ -284,7 +284,7 @@ The most efficient way to implement low-level caching is using the `Rails.cache.
Consider the following example. An application has a `Product` model with an instance method that looks up the product’s price on a competing website. The data returned by this method would be perfect for low-level caching:
```ruby
-class Product < ActiveRecord::Base
+class Product < ApplicationRecord
def competing_price
Rails.cache.fetch("#{cache_key}/competing_price", expires_in: 12.hours) do
Competitor::API.find_price(id)