Starting from 4.1, Rails automatically detects the inverse of an association, based on heuristics. Unfortunately, it does not seem to notify you when it fails to infer the :inverse_of
, so you are better off to always manually set :inverse_of anyway.
Note that automatic inverse detection only works on
has_many
,has_one
,belongs_to
associations. Extra options on the associations will prevent the association's inverse from being found automatically.
Sources
- Why do I need
:inverse_of
? Read this card - 4.1 Release Notes Show archive.org snapshot
- Original Pull Request Show archive.org snapshot
- Update PR Show archive.org snapshot
Posted by Dominik Schöler to makandra dev (2015-06-02 09:31)