Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Friendship
- include Mongoid::Document
- include Mongoid::Timestamps
- field :user_id
- field :friend_id
- field :created_at, :type => DateTime
- belongs_to :user
- belongs_to :friend, :class_name => 'User'
- end
- ###
- class Post
- belongs_to :user
- end
- ###
- class User
- has_many :posts
- has_many :friendships
- has_many :friends, :through => :friendships
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement