Created
January 2, 2011 07:50
-
-
Save apolzon/762390 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class User | |
| include Mongoid::Document | |
| references_many :sombreros, :inverse_of => :wearer, :class_name => "Hat" | |
| end | |
| class Hat | |
| references_in :wearer, :inverse_of => :sombreros, :class_name => "User", :stored_as => :array | |
| end | |
| User.sombreros uses a Mongoid::Criterio with an @selector querying the user_id. It should query for the wearer_id. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment