I’m working on a project that has almost the same user relations as Twitter. User can be a fan of another user (following) and a user has many fans (followers).
How can I write this using Mongoid and Rails 3.1?
Is it enough with the User model?
class User
inc...
inc...
has_many :following, class_name: 'User'
has_many :followers, class_name: 'User'
end
Anyone done this before? I found some old posts about this issue but they were old and outdated.
1 Answer