The counter_cache_column?
method is depending of initialisation order.
#50768
Labels
counter_cache_column?
method is depending of initialisation order.
#50768
Steps to reproduce
Expected behavior
the
Person
class should identify clearlycars_count
as a counter cache columnActual behavior
Since
Person
is initialized afterwards, when runningbelong_to
, thecars_count
column is not added to its counter_cacheSystem configuration
Rails version: found in
7.1.2
, present in edge as wellRuby version: 3.2.1
Notes
In the actual ActiveRecord test suite, this test could fall if in the future a file requiring first
models/car
is loaded before thecounter_cache_test
file.Also I'd be so glad to work on the solution. It seems to me that the issue is that this expression can return
nil
. I'm just not sure how it should be solved (by raising, autoloading, warning, ...)The text was updated successfully, but these errors were encountered: