Skip to content

Instantly share code, notes, and snippets.

@ryanfitz
Created February 2, 2011 23:09
Show Gist options
  • Save ryanfitz/808652 to your computer and use it in GitHub Desktop.
Save ryanfitz/808652 to your computer and use it in GitHub Desktop.
class User
include Mongoid::Document
field :username, :type => String
field :full_name, :type => String
references_many :friends, :class_name => 'User', :stored_as => :array, :inverse_of => :followers
references_many :followers, :class_name => "User", :stored_as => :array, :inverse_of => :friends
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment