aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorschneems <richard.schneeman+foo@gmail.com>2018-09-20 20:40:31 -0500
committerschneems <richard.schneeman+foo@gmail.com>2018-09-20 20:40:31 -0500
commit3424bd83d699bb996aa27d85b970e484d37e3485 (patch)
treedcef5ad547631c8680763cd57479259d2ddc75ed /activerecord
parent135d3e15b72b9820212027b057df8980140a947b (diff)
downloadrails-3424bd83d699bb996aa27d85b970e484d37e3485.tar.gz
rails-3424bd83d699bb996aa27d85b970e484d37e3485.tar.bz2
rails-3424bd83d699bb996aa27d85b970e484d37e3485.zip
Switch to supports_cache_versioning? check to a class method
- Moving the `supports_cache_versioning?` check to a class method. - Shorten the method doc. - Expand on the error message.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/railtie.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb
index fcee3de0b7..812fecbf32 100644
--- a/activerecord/lib/active_record/railtie.rb
+++ b/activerecord/lib/active_record/railtie.rb
@@ -92,17 +92,19 @@ module ActiveRecord
config.after_initialize do |app|
ActiveSupport.on_load(:active_record) do
if app.config.active_record.cache_versioning && Rails.cache
- unless Rails.cache.try(:supports_in_cache_versioning?)
+ unless Rails.cache.class.try(:supports_cache_versioning?)
raise <<-end_error
-You're using a cache store `#{Rails.cache.class}` that does not support
-"recyclable" cache keys, also known as "in cache versioning". To
-fix this issue either disable "recyclable" cache keys by setting:
+You're using a cache store that doesn't support native cache versioning.
+Your best option is to upgrade to a newer version of #{Rails.cache.class}
+that supports cache versioning (#{Rails.cache.class}.supports_cache_versioning? #=> true).
- config.active_record.cache_versioning = false
+Next best, switch to a different cache store that does support cache versioning:
+https://guides.rubyonrails.org/caching_with_rails.html#cache-stores.
+
+To keep using the current cache store, you can turn off cache versioning entirely:
-Or switching to a cache store that supports this functionality:
-https://guides.rubyonrails.org/caching_with_rails.html#cache-stores
+ config.active_record.cache_versioning = false
end_error
end