Created
August 19, 2011 19:04
-
-
Save hamannp/1157703 to your computer and use it in GitHub Desktop.
user.rb
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
class Team | |
include Mongoid::Document | |
has_and_belongs_to_many :captains, class_name: 'User', inverse_of: :team_captained, autosave: true | |
has_and_belongs_to_many :members, class_name: 'User', inverse_of: :team_joined, autosave: true | |
references_one :owner, class_name: "User", autosave: true | |
end |
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
class User | |
include Mongoid::Document | |
has_and_belongs_to_many :team_captained, class_name: "Team", inverse_of: :captains | |
has_and_belongs_to_many :team_joined, class_name: "Team", inverse_of: :members | |
referenced_in :team, inverse_of: :owner | |
## rest of user code | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment