-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME
38 lines (31 loc) · 919 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
###mongoid_followable###
* * *
### Installation###
In console:
gem install mongoid_followable
or in Gemfile:
gem 'mongoid_followable'
* * *
###Usage###
To make model followable you need to include Mongoid::Followable into your document:
class User
include Mongoid::Document
include Mongoid::Followable
end
Now you can follow others in your controller:
...
@user = some_other_user
current_user.follow(@user)
current_user.unfollow(@user)
current_user.follower_of?(@user)
current_user.followee_of?(@user)
current_user.follower_count
current_user.followee_count
User.followers_of(current_user)
User.followees_of(current_user)
...
**In current version, only following the same model is allowed**
###TODO###
inter-models followable
###Copyright###
Copyright © Jie Fan. See LICENSE.txt for further details.