consul 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of consul might be problematic. Click here for more details.

@@ -39,8 +39,13 @@ module Consul
39
39
  ids_method = power_ids_name(name)
40
40
  define_method(ids_method) do |*args|
41
41
  scope = send(name, *args)
42
- scope_ids = scope.scoped(:select => "`#{scope.table_name}`.`id`")
43
- scope_ids.collect(&:id)
42
+ scope = scope.scoped(:select => "`#{scope.table_name}`.`id`")
43
+ query = if scope.respond_to?(:to_sql)
44
+ scope.to_sql
45
+ else
46
+ scope.construct_finder_sql({})
47
+ end
48
+ ::ActiveRecord::Base.connection.select_values(query).collect(&:to_i)
44
49
  end
45
50
  memoize ids_method
46
51
  name
@@ -1,3 +1,3 @@
1
1
  module Consul
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
@@ -41,7 +41,7 @@ describe Consul::Power do
41
41
  end
42
42
 
43
43
  it 'should cache scope ids' do
44
- @user.power.should_receive(:clients).once.and_return(double('scope').as_null_object)
44
+ @user.power.should_receive(:clients).once.and_return(double('scope', :construct_finder_sql => 'SELECT 1').as_null_object)
45
45
  2.times { @user.power.client_ids }
46
46
  end
47
47
 
@@ -62,7 +62,7 @@ describe Consul::Power do
62
62
  end
63
63
 
64
64
  it 'should only trigger a single query for multiple checks on the same scope' do
65
- ActiveRecord::Base.connection.should_receive(:select_all).once.and_return([]) #.and_return(double('connection').as_null_object)
65
+ ActiveRecord::Base.connection.should_receive(:select_values).once.and_return([]) #.and_return(double('connection').as_null_object)
66
66
  @user.power.client?(@client1)
67
67
  @user.power.client?(@deleted_client)
68
68
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consul
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.2.2
9
+ - 3
10
+ version: 0.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Henning Koch
@@ -15,12 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-29 00:00:00 +01:00
19
- default_executable:
18
+ date: 2012-06-05 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
22
  none: false
25
23
  requirements:
26
24
  - - ">="
@@ -29,12 +27,12 @@ dependencies:
29
27
  segments:
30
28
  - 0
31
29
  version: "0"
32
- name: rails
33
- version_requirements: *id001
30
+ requirement: *id001
31
+ prerelease: false
34
32
  type: :runtime
33
+ name: rails
35
34
  - !ruby/object:Gem::Dependency
36
- prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
35
+ version_requirements: &id002 !ruby/object:Gem::Requirement
38
36
  none: false
39
37
  requirements:
40
38
  - - ">="
@@ -43,12 +41,12 @@ dependencies:
43
41
  segments:
44
42
  - 0
45
43
  version: "0"
46
- name: assignable_values
47
- version_requirements: *id002
44
+ requirement: *id002
45
+ prerelease: false
48
46
  type: :runtime
47
+ name: assignable_values
49
48
  - !ruby/object:Gem::Dependency
50
- prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
49
+ version_requirements: &id003 !ruby/object:Gem::Requirement
52
50
  none: false
53
51
  requirements:
54
52
  - - ~>
@@ -58,12 +56,12 @@ dependencies:
58
56
  - 2
59
57
  - 3
60
58
  version: "2.3"
61
- name: rails
62
- version_requirements: *id003
59
+ requirement: *id003
60
+ prerelease: false
63
61
  type: :development
62
+ name: rails
64
63
  - !ruby/object:Gem::Dependency
65
- prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
64
+ version_requirements: &id004 !ruby/object:Gem::Requirement
67
65
  none: false
68
66
  requirements:
69
67
  - - ~>
@@ -73,12 +71,12 @@ dependencies:
73
71
  - 1
74
72
  - 3
75
73
  version: "1.3"
76
- name: rspec
77
- version_requirements: *id004
74
+ requirement: *id004
75
+ prerelease: false
78
76
  type: :development
77
+ name: rspec
79
78
  - !ruby/object:Gem::Dependency
80
- prerelease: false
81
- requirement: &id005 !ruby/object:Gem::Requirement
79
+ version_requirements: &id005 !ruby/object:Gem::Requirement
82
80
  none: false
83
81
  requirements:
84
82
  - - ~>
@@ -88,12 +86,12 @@ dependencies:
88
86
  - 1
89
87
  - 3
90
88
  version: "1.3"
91
- name: rspec-rails
92
- version_requirements: *id005
89
+ requirement: *id005
90
+ prerelease: false
93
91
  type: :development
92
+ name: rspec-rails
94
93
  - !ruby/object:Gem::Dependency
95
- prerelease: false
96
- requirement: &id006 !ruby/object:Gem::Requirement
94
+ version_requirements: &id006 !ruby/object:Gem::Requirement
97
95
  none: false
98
96
  requirements:
99
97
  - - ">="
@@ -102,12 +100,12 @@ dependencies:
102
100
  segments:
103
101
  - 0
104
102
  version: "0"
105
- name: shoulda-matchers
106
- version_requirements: *id006
103
+ requirement: *id006
104
+ prerelease: false
107
105
  type: :development
106
+ name: shoulda-matchers
108
107
  - !ruby/object:Gem::Dependency
109
- prerelease: false
110
- requirement: &id007 !ruby/object:Gem::Requirement
108
+ version_requirements: &id007 !ruby/object:Gem::Requirement
111
109
  none: false
112
110
  requirements:
113
111
  - - ">="
@@ -116,9 +114,10 @@ dependencies:
116
114
  segments:
117
115
  - 0
118
116
  version: "0"
119
- name: sqlite3
120
- version_requirements: *id007
117
+ requirement: *id007
118
+ prerelease: false
121
119
  type: :development
120
+ name: sqlite3
122
121
  description: A scope-based authorization solution for Ruby on Rails.
123
122
  email: henning.koch@makandra.de
124
123
  executables: []
@@ -175,7 +174,6 @@ files:
175
174
  - spec/spec_helper.rb
176
175
  - spec/support/spec.opts
177
176
  - spec/support/spec_candy.rb
178
- has_rdoc: true
179
177
  homepage: https://github.com/makandra/consul
180
178
  licenses: []
181
179
 
@@ -205,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
203
  requirements: []
206
204
 
207
205
  rubyforge_project:
208
- rubygems_version: 1.3.9.3
206
+ rubygems_version: 1.8.10
209
207
  signing_key:
210
208
  specification_version: 3
211
209
  summary: A scope-based authorization solution for Ruby on Rails.