From Rails Guide:
There are a few limitations to inverse_of support:
- They do not work with :through associations.
- They do not work with polymorphic associations.
- They do not work with :as associations.
- For belongs_to associations, has_many inverse associations are ignored.
This is no longer true. The inverse_of
is supported by through, polymorphic and belongs_to
and has_many
associations. The automatic detection however is not supported for through
and associations which define foreign_key
.
https://guides.rubyonrails.org/association_basics.html#bi-directional-associations
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With