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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed824f9e11cab8950dd941dd080bc73304d86411
4
- data.tar.gz: 6e2ca13bb345b5e8a3ecfb220e565cbd39a8fd99
3
+ metadata.gz: f50e0deb3b3780d566b3f87b9c231b31a204fa12
4
+ data.tar.gz: 6a67c57e4a335a248f9d205400a42041b71296e2
5
5
  SHA512:
6
- metadata.gz: 15245fd8370230189b7837512b19c2c1468140d385993057f5325151c1768f3ec6a91804a7fd4baf06af510b900e3b8e7db0124d6b6c8db80337aa11bc96917f
7
- data.tar.gz: c29d4ed8fa6228e31ca7d7dbebef793aa3d40635456c5123ac1883ab0c3516fb790ce5465c68cfd257cb276ef5d2b9561c2cd8b63d1c4e3f8e71c42a11fa14eb
6
+ metadata.gz: 15550b7dc044f530c06af839736bda248895fd6f1e252f3bc3d2eceb6b6e616d91e06843f189b7be6a7ea55aa54db37dd39b4c33134e5d84b5d2c1ca8b7561ef
7
+ data.tar.gz: 685977b29742d67f9e82ec1e2cd6064203f70807ee4570f4142600f211c8e07f7a8995e2cfbf64214e86b3bb5573044672c7a46688b7ea9e16a62fb250b6dd68
data/.gitignore CHANGED
@@ -4,6 +4,9 @@ pkg/*
4
4
  spec/db/*.db
5
5
  nbproject
6
6
  .rvmrc
7
+ .ruby-version
8
+ .ruby-gemset
9
+ .idea
7
10
  *.sw[a-z]
8
11
  .rspec
9
12
  database.yml
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- amistad (0.10.0)
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)
@@ -14,8 +14,6 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "amistad"
16
16
 
17
- s.add_dependency 'squeel'
18
-
19
17
  s.add_development_dependency "bundler"
20
18
  s.add_development_dependency "rake"
21
19
  s.add_development_dependency "rspec", "~> 3.1.0"
@@ -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
- approved_friendships = friendship_model.where{
68
- ( friendable_id == my{id} ) &
69
- ( pending == false ) &
70
- ( blocker_id == nil )
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
@@ -1,3 +1,3 @@
1
1
  module Amistad
2
- VERSION = "0.10.0"
2
+ VERSION = "0.10.1"
3
3
  end
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.0
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-09-24 00:00:00.000000000 Z
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