We have a problem during upgrade Rails from 7.0.8 to 7.1.3.2 with reading AR models from Redis cache.
We have several places where we cache AR models with Redis:
Rails.cache.fetch("key_name") { Ar_Model[some_key] }
After Rails upgrade we can't read all params (except id) from model. Example:
Run two same consoles.In one of them:
model = Rails.cache.fetch("key_name") { Ar_Model[some_key] }model.class => Ar_Model(id: integer, name: string)model.name => "some_name"
But in the second console:
model = Rails.cache.fetch("key_name")model.class => Ar_Model(id: integer, name: string)model.id => some_idmodel.name => Error! Unknown method 'name' for Ar_Model()
Interestingly, after run, for example, Ar_Model.first
in the second console, we can read all params from model without any reloading.
model = Rails.cache.fetch("key_name")model.class => Ar_Model(id: integer, name: string)model.id => some_idmodel.name => Error! Unknown method 'name' for Ar_Model()Ar_Model.firstmodel.name => "some_name"