-
Type: Bug
-
Resolution: Duplicate
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
When you have Models inside modules:
module EmmSpec class Car include Mongoid::Document embeds_many :doors end class Door include Mongoid::Document embedded_in :car end end
The inverse association is not calculated correctly:
door._association.inverse_association # nil
This has to do with how we calculate the inverse. One of the conditions for a class being the inverse is:
rel.relation_class_name.sub(/\A::/, '') == inverse_class_name
However here, rel.relation_class_name is "Car" while the inverse_class_name is "EmmSpec::Car".
Also include a test for the following case:
> On embedded relations with touch: true, there is strange behavior the parent accessor on a child document (i.e. for A and B where A is the parent of B, b.a is nil) which is causing the touch not to persist on the parent.
which is caused by this issue.
- causes
-
MONGOID-5274 Implement touch: false for embedded documents, permitting saving of child without touching parent
- Closed
- duplicates
-
MONGOID-5080 Inverses aren't found for embedded association in modules
- Backlog
- related to
-
MONGOID-5080 Inverses aren't found for embedded association in modules
- Backlog
-
MONGOID-4834 Getting associated objects for classes in modules
- Backlog