amistad 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/Gemfile.lock +1 -8
- data/amistad.gemspec +0 -2
- data/lib/amistad/active_record_friend_model.rb +4 -18
- data/lib/amistad/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f50e0deb3b3780d566b3f87b9c231b31a204fa12
|
4
|
+
data.tar.gz: 6a67c57e4a335a248f9d205400a42041b71296e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15550b7dc044f530c06af839736bda248895fd6f1e252f3bc3d2eceb6b6e616d91e06843f189b7be6a7ea55aa54db37dd39b4c33134e5d84b5d2c1ca8b7561ef
|
7
|
+
data.tar.gz: 685977b29742d67f9e82ec1e2cd6064203f70807ee4570f4142600f211c8e07f7a8995e2cfbf64214e86b3bb5573044672c7a46688b7ea9e16a62fb250b6dd68
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
amistad (0.10.
|
5
|
-
squeel
|
4
|
+
amistad (0.10.1)
|
6
5
|
|
7
6
|
GEM
|
8
7
|
remote: http://rubygems.org/
|
@@ -57,8 +56,6 @@ GEM
|
|
57
56
|
pg (0.17.1)
|
58
57
|
plucky (0.3.8)
|
59
58
|
mongo (~> 1.3)
|
60
|
-
polyamorous (1.1.0)
|
61
|
-
activerecord (>= 3.0)
|
62
59
|
rake (10.3.2)
|
63
60
|
rspec (3.1.0)
|
64
61
|
rspec-core (~> 3.1.0)
|
@@ -74,10 +71,6 @@ GEM
|
|
74
71
|
rspec-support (3.1.0)
|
75
72
|
ruby-progressbar (1.6.0)
|
76
73
|
sqlite3 (1.3.9)
|
77
|
-
squeel (1.2.1)
|
78
|
-
activerecord (>= 3.0)
|
79
|
-
activesupport (>= 3.0)
|
80
|
-
polyamorous (~> 1.1.0)
|
81
74
|
thread_safe (0.3.4)
|
82
75
|
tzinfo (1.2.2)
|
83
76
|
thread_safe (~> 0.1)
|
data/amistad.gemspec
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'squeel'
|
2
|
-
|
3
1
|
module Amistad
|
4
2
|
module ActiveRecordFriendModel
|
5
3
|
extend ActiveSupport::Concern
|
@@ -64,22 +62,10 @@ module Amistad
|
|
64
62
|
def friends
|
65
63
|
friendship_model = Amistad::Friendships.const_get(:"#{Amistad.friendship_model}")
|
66
64
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
}
|
72
|
-
|
73
|
-
approved_inverse_friendships = friendship_model.where{
|
74
|
-
( friend_id == my{id} ) &
|
75
|
-
( pending == false ) &
|
76
|
-
( blocker_id == nil )
|
77
|
-
}
|
78
|
-
|
79
|
-
self.class.where{
|
80
|
-
( id.in(approved_friendships.select{friend_id}) ) |
|
81
|
-
( id.in(approved_inverse_friendships.select{friendable_id}) )
|
82
|
-
}
|
65
|
+
approved_friendship_ids = friendship_model.where(friendable_id: id, pending: false, blocker_id: nil).select(:friend_id).map(&:friend_id)
|
66
|
+
approved_inverse_friendship_ids = friendship_model.where(friend_id: id, pending: false, blocker_id: nil).select(:friendable_id).map(&:friendable_id)
|
67
|
+
|
68
|
+
self.class.where(id: approved_friendship_ids + approved_inverse_friendship_ids)
|
83
69
|
end
|
84
70
|
|
85
71
|
# total # of invited and invited_by without association loading
|
data/lib/amistad/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amistad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rawane ZOSSOU
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: squeel
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: bundler
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|