-
-
Save derekbrameyer/6988ae9a1b50de1108c1 to your computer and use it in GitHub Desktop.
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 Relationship | |
include Mongoid::Document | |
named_scope :following, where(:rel_type => "following") | |
named_scope :followed_by, where(:rel_type => "followed_by") | |
named_scope :friends_with, where(:rel_type => "friends_with") | |
# rel_type can be "following" "followed_by" or "friends_with" | |
field :rel_type, :type => String | |
field :rel_user, :class_name => "User" | |
#has_one_related :rel_user, :class_name => "User" | |
embedded_in :user, :inverse_of => :relationships | |
def establish_relationship | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment