directiverecord 0.1.22 → 0.1.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MGRkZjA3NjA3YzdmY2IzZTkwODg3ZTcyNzczZDVkYmE4MzRlZjk4MA==
5
- data.tar.gz: !binary |-
6
- MGM1NjBkMDM2ZjRiMThiYTQ5NzAxNzIyN2NhM2IwM2QxZTY2OTlkOA==
2
+ SHA1:
3
+ metadata.gz: beaaac82f30ff3e1c16a7c5844497500badcbbdb
4
+ data.tar.gz: 60eb917a702a908c1ac2930b805d8ab68758603b
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- OTNiYTViM2I0YjU5MjAyOWI1ZGFmYjU2MDMwMDhjMjRkYzcyYWVhNGJhNGE2
10
- NTk2ZDkyYmE5YmExNDFmNGMwMWM0M2Q0OWZkMGU2MTQzZDQ3ZmNiNDdlZjQ4
11
- NTc1NDRkNDFjNGRlZjA0NWM2MjUyYjU4YTM5N2UxMGYxYTkxNzg=
12
- data.tar.gz: !binary |-
13
- NGZjNTFmMTg3ZmFkN2Q0ZjE4MjY2OWMxYmMzNzVkMzk5YjA3NGFkYjdjMzAw
14
- ZjdmYjgyOTMxY2UxMTMxNDJkZjM2MGVkMDJiMzA4ZGViNTJhZGIxNjNlNGQz
15
- NDljNWEwZDllYzU3MjNkNWM3NWMxODJkYjZhZjBhZjc5MTNmMjM=
6
+ metadata.gz: de73729b955fe0d5df7e026b413fd4a425bd6f28232bd0ecc6c46bea53bdf52db0603e62dc62d0e6ee4b5ac4d1024efb40dfd5023727b3dfc55820f1418cf3b9
7
+ data.tar.gz: 981c5d1921382b87d20fc6f62293b6dbc62f20e05d0c92c7ce26b09844878ff664671486c4d1fa592a577b9931a42e4e4c4672c187989b170c419e0b1462f9a7
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = DirectiveRecord CHANGELOG
2
2
 
3
+ == Version 0.1.23 (April 9, 2015)
4
+
5
+ * Extracted ActiveRecord::Relation#count override to separate (non-auto-required) source file
6
+
3
7
  == Version 0.1.22 (April 8, 2015)
4
8
 
5
9
  * Corrected deriving qry_options from habtm associations
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.22
1
+ 0.1.23
@@ -13,28 +13,5 @@ module ActiveRecord
13
13
  klass.qry qry_options(*args)
14
14
  end
15
15
 
16
- alias :original_count :count
17
-
18
- def count(column_name = nil, options = {})
19
- if !loaded? && (column_name == :all) && (options == {})
20
- associations = klass.reflections.keys.collect(&:to_s)
21
-
22
- contains_possible_paths = qry_options.any? do |key, value|
23
- if value.is_a?(Array)
24
- value.any? do |val|
25
- val.to_s.scan(/(?:^|[^\.])([a-z_]+)\.[a-z_]+/).flatten.any? do |string|
26
- associations.include?(string)
27
- end
28
- end
29
- end
30
- end
31
-
32
- if contains_possible_paths
33
- return qry("COUNT(DISTINCT id)")[0][0]
34
- end
35
- end
36
- original_count column_name, options
37
- end
38
-
39
16
  end
40
17
  end
@@ -0,0 +1,28 @@
1
+ module ActiveRecord
2
+ class Relation
3
+
4
+ alias :original_count :count
5
+
6
+ def count(column_name = nil, options = {})
7
+ if !loaded? && (column_name == :all) && (options == {})
8
+ associations = klass.reflections.keys.collect(&:to_s)
9
+
10
+ contains_possible_paths = qry_options.any? do |key, value|
11
+ if value.is_a?(Array)
12
+ value.any? do |val|
13
+ val.to_s.scan(/(?:^|[^\.])([a-z_]+)\.[a-z_]+/).flatten.any? do |string|
14
+ associations.include?(string)
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ if contains_possible_paths
21
+ return qry("COUNT(DISTINCT id)")[0][0]
22
+ end
23
+ end
24
+ original_count column_name, options
25
+ end
26
+
27
+ end
28
+ end
@@ -1,7 +1,7 @@
1
1
  module DirectiveRecord
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- TINY = 22
4
+ TINY = 23
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join(".")
7
7
  end
data/test/test_helper.rb CHANGED
@@ -6,6 +6,7 @@ require "mocha/setup"
6
6
  require "bundler"
7
7
  Bundler.require :default, :development
8
8
 
9
+ require "directive_record/gem_ext/active_record/relation/count"
9
10
  require_relative "application/boot"
10
11
 
11
12
  def project_file(path)
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: directiverecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.22
4
+ version: 0.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Engel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-08 00:00:00.000000000 Z
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.2.13
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.13
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: arel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - <
31
+ - - "<"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 6.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - <
38
+ - - "<"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 6.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: yard
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mysql2
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ! '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: minitest
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ! '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ! '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: mocha
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ! '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ! '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  description: A layer on top of ActiveRecord for using paths within queries without
@@ -143,7 +143,7 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
- - .gitignore
146
+ - ".gitignore"
147
147
  - CHANGELOG.rdoc
148
148
  - Gemfile
149
149
  - MIT-LICENSE
@@ -156,6 +156,7 @@ files:
156
156
  - lib/directive_record/gem_ext/active_record.rb
157
157
  - lib/directive_record/gem_ext/active_record/base.rb
158
158
  - lib/directive_record/gem_ext/active_record/relation.rb
159
+ - lib/directive_record/gem_ext/active_record/relation/count.rb
159
160
  - lib/directive_record/query.rb
160
161
  - lib/directive_record/query/big_query.rb
161
162
  - lib/directive_record/query/mysql.rb
@@ -195,17 +196,17 @@ require_paths:
195
196
  - lib
196
197
  required_ruby_version: !ruby/object:Gem::Requirement
197
198
  requirements:
198
- - - ! '>='
199
+ - - ">="
199
200
  - !ruby/object:Gem::Version
200
201
  version: '0'
201
202
  required_rubygems_version: !ruby/object:Gem::Requirement
202
203
  requirements:
203
- - - ! '>='
204
+ - - ">="
204
205
  - !ruby/object:Gem::Version
205
206
  version: '0'
206
207
  requirements: []
207
208
  rubyforge_project:
208
- rubygems_version: 2.1.11
209
+ rubygems_version: 2.2.2
209
210
  signing_key:
210
211
  specification_version: 4
211
212
  summary: A layer on top of ActiveRecord for using paths within queries without thinking