-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: 7.0.2
-
Component/s: Associations
-
None
MONGOID-4532 (Github PRĀ #4536) causes a regression in Mongoid 7.0.2.
When a namespaced child model includes a belongs_to, 7.0.1 and prior assumed that association was not-namespaced.
7.0.2 introduced a breaking change that now assumes that association is always namespaced inside the same module.
Code to reproduce: https://gist.github.com/zarqman/d307ecf40a65fbe1b0fc71ea0d36ac69
A workaround is to explicitly specify the :class_name for the association (as shown in the commented out line 40).
Would it be possible for Mongoid's :class_name auto-detection to follow traditional Ruby semantics? That is, default to searching for Space::Other and if not found, then search for ::Other?
If this isn't possible, then I would suggest reverting the change in PR #4536 since it is a code-breaking regression.
- is caused by
-
MONGOID-4532 Namespaced models in relations are not found
- Closed
- links to