jit_preloader 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -2
- data/README.md +1 -1
- data/lib/jit_preloader/active_record/base.rb +5 -2
- data/lib/jit_preloader/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b508dc508f804374c434fdcb808594840b0bd1a
|
4
|
+
data.tar.gz: e121854c6408c3d1423a1e272fe23fc7365a2d03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4929e0d516ccf9056fbe4249127d9fcc599cfef7e62d0d3d684c121ff86fc4f7daef4454aed5e6cd36d9af4252457774c6a7c35bb3a3ef4d6215056ced005056
|
7
|
+
data.tar.gz: a250cbb9ba56a7e9bb8e98b57b09ef02cc75ef7afb31add20c1ce9c1d00b08349048966a0c65df7c1c6edac78ef023f2d7b262e056c134ec84719532a5d6c707
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jit_preloader (0.0.
|
4
|
+
jit_preloader (0.0.6)
|
5
5
|
activerecord (~> 4.2)
|
6
6
|
activesupport
|
7
7
|
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
diff-lcs (1.2.5)
|
29
29
|
i18n (0.7.0)
|
30
30
|
json (1.8.3)
|
31
|
-
minitest (5.
|
31
|
+
minitest (5.10.1)
|
32
32
|
rake (10.5.0)
|
33
33
|
rspec (3.5.0)
|
34
34
|
rspec-core (~> 3.5.0)
|
@@ -59,3 +59,6 @@ DEPENDENCIES
|
|
59
59
|
rake (~> 10.0)
|
60
60
|
rspec
|
61
61
|
sqlite3
|
62
|
+
|
63
|
+
BUNDLED WITH
|
64
|
+
1.13.6
|
data/README.md
CHANGED
@@ -159,7 +159,7 @@ end
|
|
159
159
|
#new
|
160
160
|
class Contact < ActiveRecord::Bas
|
161
161
|
has_many :addresses
|
162
|
-
has_many_aggregate :addresses, :max_street_length, :maximum, "LENGTH(street)"
|
162
|
+
has_many_aggregate :addresses, :max_street_length, :maximum, "LENGTH(street)", default: nil
|
163
163
|
has_many_aggregate :addresses, :count_all, :count, "*"
|
164
164
|
end
|
165
165
|
|
@@ -17,13 +17,16 @@ module JitPreloadExtension
|
|
17
17
|
define_method(method_name) do
|
18
18
|
self.jit_preload_aggregates ||= {}
|
19
19
|
|
20
|
-
return jit_preload_aggregates[method_name] if jit_preload_aggregates
|
20
|
+
return jit_preload_aggregates[method_name] if jit_preload_aggregates.key?(method_name)
|
21
21
|
if jit_preloader
|
22
22
|
reflection = association(assoc).reflection
|
23
23
|
primary_ids = jit_preloader.records.collect{|r| r[reflection.active_record_primary_key] }
|
24
24
|
klass = reflection.klass
|
25
25
|
|
26
|
-
|
26
|
+
association_scope = klass
|
27
|
+
association_scope = association_scope.instance_exec(&reflection.scope).reorder(nil) if reflection.scope
|
28
|
+
|
29
|
+
preloaded_data = Hash[association_scope
|
27
30
|
.where(reflection.foreign_key => primary_ids)
|
28
31
|
.group(reflection.foreign_key)
|
29
32
|
.send(aggregate, field)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jit_preloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle d'Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|