popular 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/popular/popular.rb +6 -3
- data/lib/popular/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
M2I0MWRjOTZjNTc2YTVlYTRmNmVmMWQwZDYxMjFiNDgzOGNhY2I3Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWY2Yzg2MTZhMjcxNGZmYThmOThmM2ViMDdjMmNiNDkzM2I0YjM5Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDZjZDJmZGRmMzk5NTRkNzk4YzU5ZjAwNTM2ZTYyODY1ODU3YjVlMTMxNzdl
|
10
|
+
NDk1MWZlNTBhMzA2MzA5YWQ5ZGYwZGE4NmE2ZDU2YzU1NjNiMDVlZTQ2Yjk3
|
11
|
+
OGM1YzQzOGNmZjNmMDc1ZTdhODU4NzQ0ZTE4NjQ5NDg5Y2M5YzE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODkxNjRlYzllZWRmNzJmNDNkMjQ4ODFmYzlhOWIyYWUzODI2MmIyN2VjNWYx
|
14
|
+
ZjAzMGRkMzUzNmY5MWY2MTE2NjJjNTFlMDI2ZjUzMTBhZjNhYzRmMmQyOGY1
|
15
|
+
ZWIxYjYxZTY4ZDYwYWJiMGNhMzY2OGM1NjE5Y2U3ZmMyNTc3NzI=
|
data/lib/popular/popular.rb
CHANGED
@@ -48,7 +48,7 @@ module Popular
|
|
48
48
|
# user.friends_with? other_user #=> true
|
49
49
|
def befriend new_friend
|
50
50
|
run_callbacks :befriend do
|
51
|
-
friendships.create
|
51
|
+
friendships.create friend_id: new_friend.id, friend_type: new_friend.class.name
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -65,7 +65,7 @@ module Popular
|
|
65
65
|
# user.friends_with? other_user # => true
|
66
66
|
def befriend! new_friend
|
67
67
|
run_callbacks :befriend do
|
68
|
-
friendships.create!
|
68
|
+
friendships.create! friend_id: new_friend.id, friend_type: new_friend.class.name
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -82,7 +82,10 @@ module Popular
|
|
82
82
|
# user.friends_with? other_user # => false
|
83
83
|
def unfriend friend
|
84
84
|
run_callbacks :unfriend do
|
85
|
-
friendships
|
85
|
+
friendships
|
86
|
+
.where( friend_type: friend.class.name )
|
87
|
+
.where( friend_id: friend.id )
|
88
|
+
.first.destroy
|
86
89
|
end
|
87
90
|
end
|
88
91
|
|
data/lib/popular/version.rb
CHANGED