バージョン情報
- rails 6.0.2.1
- ruby 2.6.1
内容
rails6にアップデートしたアプリにて、次のエラーが発生した。
rake aborted!
You're using a cache store that doesn't support native cache versioning.
Your best option is to upgrade to a newer version of ActiveSupport::Cache::RedisStore
that supports cache versioning (ActiveSupport::Cache::RedisStore.supports_cache_versioning? #=> true).
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:
config.active_record.cache_versioning = false
rails側設定のcache_versioningはオンなのに、RedisStore側がバージョニングに対応していない的なエラーらしい。
でも、ActiveSupport::Cache::RedisStore.supports_cache_versioning? #=> true
って出てるじゃん?
どういうこった?
エラー文に書いてあるrailsガイドを参照してみる。
https://guides.rubyonrails.org/caching_with_rails.html#cache-stores
ここで使われているcache_store名がredis_cache_store
となっているのだけど、私が設定していたcache_storeはgem redis-railsを使ったredis_store
を設定していた。
どうやら、rails 5.2からgem redis-rails
は必要なくなっていたみたい・・。
https://github.com/redis-store/redis-rails/pull/81
というわけで、redis-railsを削除して、redis_store
をredis_cache_store
に変更したらエラーが発生しなくなり、railsが起動できました。
めでたしめでたし。