This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the identity map for retrieving the parent resource in a many to …
…one relationship
- Loading branch information
Showing
1 changed file
with
13 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f4aff7c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are the specs? :P
f4aff7c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seriously though how would you spec this? I need to put the same fix in for OneToOne...
f4aff7c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xaviershay: Hmm, maybe have two objects in a repository block that have the same parent, and check to make sure
obj1.parent.equal?(obj2.parent)
?That's the first thing that comes to mind. I wonder if it could work. I think the usage of an IM is incidental, the important behavior is that both objects reference the same parent.
f4aff7c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this (or hopefully a cleaner version of it!) should work, but I couldn't get it to fail in spec/public/associations/many_to_one_spec.rb