Created
August 13, 2012 18:22
-
-
Save jnwelzel/3342929 to your computer and use it in GitHub Desktop.
Company -> User (owner)
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 Company | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
has_and_belongs_to_many :users | |
belongs_to :owner, class_name: "User", inverse_of: :owns | |
end | |
class User | |
include Mongoid::Document | |
include ActiveModel::SecurePassword | |
has_and_belongs_to_many :companies | |
has_many :owns, class_name: "Company", inverse_of: :owner | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment