Perhaps I’m bing a bit thick and missing something obvious (possible),
but
I found the caveats listed in section 3.5 of the Associations Rails
Guidehttp://guides.rubyonrails.org/association_basics.html badly
worded and confusing.
The section gives an example with a has_many <-> belongs_to relationship
is
setup with inverse associations on both side, but then states the
caveat*“For belongs_to associations, has_many inverse associations are
ignored.”
*
Could someone actually explain what that means in concrete terms? The
example and the caveat appear to be contradictory. If the caveat is
correct
then I’m not sure I understand how the example works.
It is useful in a small number of situations, mostly where you need to
ensure that two different references to the same object actually refer
to
the same instance. I’ve only needed to use it twice, both times were
where
we have callbacks updating multiple related objects based on data held
in
each other.
Anyway, if anyone else does understand what that caveat actually means
I’d
appreciate an explanation.