ar_lazy_preload 0.2.1 → 0.2.2
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebe08f38d60625bee24c8ec26f8eb8d3381118f4c81f68e79abd047237d7a27e
|
4
|
+
data.tar.gz: 9d1665b388bba47dda01e592cd4dbcfaeb6b8aa3cafbd047b92628f651431e72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '089fe899897758c02c19e31b85edbe71ad6e1df28e727017a32ae5518ea01c6a86a9438e8ff4d99ffbd6f4c5c6cb92e8480b823bd4e9c023da15328aae66cc3c'
|
7
|
+
data.tar.gz: 381a082c5f96b9927d81effb0ed577b63f709e110344e241c7c278509785b0954bc553dfdb0cfd3531e71da61d9f9f111c7e61b469ae2eacd61c60ca6c5b106e
|
data/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "appraisal"
|
1
2
|
require "bundler/gem_tasks"
|
2
3
|
require "rspec/core/rake_task"
|
3
4
|
require "rubocop/rake_task"
|
@@ -5,4 +6,10 @@ require "rubocop/rake_task"
|
|
5
6
|
RSpec::Core::RakeTask.new(:spec)
|
6
7
|
RuboCop::RakeTask.new
|
7
8
|
|
8
|
-
|
9
|
+
if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
|
10
|
+
task :default do
|
11
|
+
sh "rubocop && appraisal install && rake appraisal spec"
|
12
|
+
end
|
13
|
+
else
|
14
|
+
task default: [:rubocop, :spec]
|
15
|
+
end
|
@@ -10,7 +10,12 @@ module ArLazyPreload
|
|
10
10
|
def load
|
11
11
|
need_context = !loaded?
|
12
12
|
result = super
|
13
|
-
|
13
|
+
if need_context
|
14
|
+
Context.register(
|
15
|
+
records: ar_lazy_preload_records,
|
16
|
+
association_tree: lazy_preload_values
|
17
|
+
)
|
18
|
+
end
|
14
19
|
result
|
15
20
|
end
|
16
21
|
|
@@ -47,6 +52,10 @@ module ArLazyPreload
|
|
47
52
|
|
48
53
|
private
|
49
54
|
|
55
|
+
def ar_lazy_preload_records
|
56
|
+
@records
|
57
|
+
end
|
58
|
+
|
50
59
|
attr_writer :lazy_preload_values
|
51
60
|
end
|
52
61
|
end
|
@@ -5,6 +5,7 @@ require "ar_lazy_preload/active_record/relation"
|
|
5
5
|
require "ar_lazy_preload/active_record/association"
|
6
6
|
require "ar_lazy_preload/active_record/merger"
|
7
7
|
require "ar_lazy_preload/active_record/association_relation"
|
8
|
+
require "ar_lazy_preload/active_record/collection_proxy"
|
8
9
|
|
9
10
|
module ArLazyPreload
|
10
11
|
class Railtie < Rails::Railtie
|
@@ -20,6 +21,8 @@ module ArLazyPreload
|
|
20
21
|
ActiveRecord::Associations::CollectionAssociation,
|
21
22
|
ActiveRecord::Associations::Association
|
22
23
|
].each { |klass| klass.prepend(Association) }
|
24
|
+
|
25
|
+
ActiveRecord::Associations::CollectionProxy.prepend(CollectionProxy)
|
23
26
|
end
|
24
27
|
end
|
25
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar_lazy_preload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DmitryTsepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: appraisal
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: lazy_preload implementation for ActiveRecord models
|
112
126
|
email:
|
113
127
|
- dmitry.a.tsepelev@gmail.com
|
@@ -122,6 +136,7 @@ files:
|
|
122
136
|
- lib/ar_lazy_preload/active_record/association.rb
|
123
137
|
- lib/ar_lazy_preload/active_record/association_relation.rb
|
124
138
|
- lib/ar_lazy_preload/active_record/base.rb
|
139
|
+
- lib/ar_lazy_preload/active_record/collection_proxy.rb
|
125
140
|
- lib/ar_lazy_preload/active_record/merger.rb
|
126
141
|
- lib/ar_lazy_preload/active_record/relation.rb
|
127
142
|
- lib/ar_lazy_preload/associated_context_builder.rb
|