Closed tagliala closed 6 months ago
Ref:
The following code:
class ::Bar < ActiveRecord::Base
include ChronoModel::TimeMachine
belongs_to :foo
end
class ::Foo < ActiveRecord::Base
include ChronoModel::TimeMachine
has_many :bars
end
has this deprecation:
DEPRECATION WARNING: The `Bar#foo` inverse association could have been automatically inferred as `Foo#bars` but wasn't because `automatically_invert_plural_associations` is disabled.
If automatic inference is intended, you can consider enabling `config.active_record.automatically_invert_plural_associations`.
If automatic inference is not intended, you can silence this warning by defining the association with `inverse_of: false`.
After reading rails/rails#50284, I do not have idea of what is happening.
It is absolutely not clear why one should set
belongs_to :foo, inverse_of: false
🤷🏼♂️