has_friendship 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b63298f12c937856534b768fd95c49f1ff657e2c
|
4
|
+
data.tar.gz: d1e9db82b9423243e31116c1f11069d7c5da4a87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96074edc5f0ffaf553834f17b614073146119219396537f6e6a8ac8a5a4ed4033419c890d47640eafd4d3487701076f656a9057cde3bb2acc36b9103fe1628fd
|
7
|
+
data.tar.gz: 264da3453b7604792f08b947d69a79d712e43b65af1efaac2572a1f0ab5f28af187110367ac6f2255ccb16d3a938522fd7e052043bb5b9195327762a3d4d427f
|
@@ -6,10 +6,10 @@ module HasFriendship
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def has_friendship
|
9
|
-
|
9
|
+
|
10
10
|
class_eval do
|
11
11
|
has_many :friendships, as: :friendable, class_name: "HasFriendship::Friendship", dependent: :destroy
|
12
|
-
has_many :friends,
|
12
|
+
has_many :friends,
|
13
13
|
-> { where friendships: { status: 'accepted' } },
|
14
14
|
through: :friendships
|
15
15
|
|
@@ -69,6 +69,10 @@ module HasFriendship
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
+
def friends_with?(friend)
|
73
|
+
HasFriendship::Friendship.where(friend_id: friend.id, status: 'accepted').present?
|
74
|
+
end
|
75
|
+
|
72
76
|
end
|
73
77
|
end
|
74
|
-
end
|
78
|
+
end
|
@@ -10,7 +10,7 @@ module HasFriendship
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.find_friendship(friendable, friend)
|
13
|
-
|
13
|
+
find_by(friendable_id: friendable.id, friendable_type: friendable.class.base_class.name, friend_id: friend.id)
|
14
14
|
end
|
15
15
|
end
|
16
|
-
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_friendship
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sung Won Cho
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: byebug
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description:
|
112
126
|
email:
|
113
127
|
- mikeswcho@gmail.com
|
@@ -124,7 +138,6 @@ files:
|
|
124
138
|
- lib/has_friendship/friendable.rb
|
125
139
|
- lib/has_friendship/friendship.rb
|
126
140
|
- lib/has_friendship/version.rb
|
127
|
-
- lib/tasks/has_friendship_tasks.rake
|
128
141
|
homepage: https://github.com/sungwoncho/has_friendship
|
129
142
|
licenses:
|
130
143
|
- MIT
|
@@ -145,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
158
|
version: '0'
|
146
159
|
requirements: []
|
147
160
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.4.
|
161
|
+
rubygems_version: 2.4.7
|
149
162
|
signing_key:
|
150
163
|
specification_version: 4
|
151
164
|
summary: Add social network friendship features to your Active Record models.
|