Skip to content

Instantly share code, notes, and snippets.

@tanordheim
Created October 4, 2010 12:45
Show Gist options
  • Save tanordheim/609635 to your computer and use it in GitHub Desktop.
Save tanordheim/609635 to your computer and use it in GitHub Desktop.
class Organization
include Mongoid::Document
field :name
referenced_in :user
end
class User
include Mongoid::Document
field :username
references_many :organizations
end
organization = Organization.new(:name => "Test Organization")
user = User.new(:username => "test")
organization.user = user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment