popular 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWJkNjhjOWRjM2FkMWRlZjBiNDc0YWNmNTQ0YjQ0ZjZlMzVlZmI2Zg==
4
+ M2I0MWRjOTZjNTc2YTVlYTRmNmVmMWQwZDYxMjFiNDgzOGNhY2I3Nw==
5
5
  data.tar.gz: !binary |-
6
- NmE2ZjEwYWIxNDFjNmE3YzRhOTEyZDE0ZTI4Zjk2OTQwMDJjZTRmZA==
6
+ YWY2Yzg2MTZhMjcxNGZmYThmOThmM2ViMDdjMmNiNDkzM2I0YjM5Zg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2Y5ZDUxNzAyODg1ODVlZjllODBjM2M5OTY5MWQzMWE3ZWQxZTNiMzA5MWJk
10
- ZGFlYWU2Y2RlMjQ4NTRjODE4MzBmNTVjN2I3NjVkYWRiYjcyMzE3OWVkYTZh
11
- NWFlZjViMTAzODgyMDFjZTZiMWFkM2ZhYzI1ZWNkZmJhMDQzMjI=
9
+ MDZjZDJmZGRmMzk5NTRkNzk4YzU5ZjAwNTM2ZTYyODY1ODU3YjVlMTMxNzdl
10
+ NDk1MWZlNTBhMzA2MzA5YWQ5ZGYwZGE4NmE2ZDU2YzU1NjNiMDVlZTQ2Yjk3
11
+ OGM1YzQzOGNmZjNmMDc1ZTdhODU4NzQ0ZTE4NjQ5NDg5Y2M5YzE=
12
12
  data.tar.gz: !binary |-
13
- YmI5YjIwNmU5NmE4ZTAyOTVjMTgxOTU3YWJkZDU5NDFmYjUzMDkxYTcyZWNm
14
- NTRhMjNmOGYzM2VhOGE3YTQ2N2EzY2EzOGRlYTBmNDY5ZmE3MTU0YzAwMDgw
15
- OTQwY2VjZDFkZjIxMzA0ZTU1YjE2OGY4MWMzYmNmOGJhMzNiY2E=
13
+ ODkxNjRlYzllZWRmNzJmNDNkMjQ4ODFmYzlhOWIyYWUzODI2MmIyN2VjNWYx
14
+ ZjAzMGRkMzUzNmY5MWY2MTE2NjJjNTFlMDI2ZjUzMTBhZjNhYzRmMmQyOGY1
15
+ ZWIxYjYxZTY4ZDYwYWJiMGNhMzY2OGM1NjE5Y2U3ZmMyNTc3NzI=
@@ -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 friend: new_friend
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! friend: new_friend
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.where( friend: friend ).first.destroy
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
 
@@ -1,3 +1,3 @@
1
1
  module Popular
2
- VERSION = "0.7.3"
2
+ VERSION = "0.7.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: popular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - thejchap