diff options
author | Genadi Samokovarov <gsamokovarov@gmail.com> | 2015-12-17 11:30:30 +0100 |
---|---|---|
committer | Genadi Samokovarov <gsamokovarov@gmail.com> | 2015-12-17 11:56:35 +0100 |
commit | c29fbd3c7aa6391e820f682a960968aab7a52d07 (patch) | |
tree | 9a7bb5f8e6345321e5ff2eba809b4f5ab9da9c1a /guides/source/caching_with_rails.md | |
parent | c4f8ce53b1f9af9585aeec9bbb0c66fc9c48ec1b (diff) | |
download | rails-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.md | 6 |
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) |