ar_lazy_preload 0.2.0 → 0.2.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
  SHA256:
3
- metadata.gz: 88bbf9af048997996a06aa5292f648fc9a5583a3335a4c088451bc7cb883f33f
4
- data.tar.gz: 784ef74c3ab97149fb237c52ce663be4d0c7f5254e2181e1967b3f8b50e37949
3
+ metadata.gz: 44023d59df2053b73589d7b0baadad0933047105fb38986462347ce9c03414b6
4
+ data.tar.gz: fc4f589d5fec1c1731f82f5b43a3fe379f795445456721db5c6140190d3669a8
5
5
  SHA512:
6
- metadata.gz: 4bda01ddd3c35f9b1e4f03966566a8c14fcffe9c64b69a9b49227b6ff481bf73d348d0576aed8919e9363ab2914fa001a1ba3fd7da5569767ea714d38704d4cc
7
- data.tar.gz: 15769ecfdd7a41f1860483aab2418c1c2f3167bcb2f67c491f120ac3d4cb00d5bb53b3540f0a3574a575f9062181f7a8c2b16fa50a4265f3e45bc032f9f63e47
6
+ metadata.gz: 1b434e21ffab60c6008dfb85c9825d0534d635ae464052bcce0544cd6d2fee81b02ec9a9e4a26d542a46f18209efcb03c971f68ca0964b807d3a6e64ec2ca1f7
7
+ data.tar.gz: e12171b02fd58053e8e189e95a2178cdddb163ac225b134b298f9a2f872117e8edcd7c0119d84e60e7d99f355e3f58bb7f9976d76a9e515edc435aaf1c95da98
@@ -1,11 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "ar_lazy_preload/configuration"
4
- require "ar_lazy_preload/ext/base"
5
- require "ar_lazy_preload/ext/relation"
6
- require "ar_lazy_preload/ext/association"
7
- require "ar_lazy_preload/ext/merger"
8
- require "ar_lazy_preload/ext/association_relation"
4
+ require "ar_lazy_preload/railtie"
9
5
 
10
6
  module ArLazyPreload
11
7
  class << self
@@ -13,15 +9,4 @@ module ArLazyPreload
13
9
  @config ||= Configuration.new
14
10
  end
15
11
  end
16
-
17
- ActiveRecord::Base.include(ArLazyPreload::Base)
18
-
19
- ActiveRecord::Relation.prepend(ArLazyPreload::Relation)
20
- ActiveRecord::AssociationRelation.prepend(ArLazyPreload::AssociationRelation)
21
- ActiveRecord::Relation::Merger.prepend(ArLazyPreload::Merger)
22
-
23
- [
24
- ActiveRecord::Associations::CollectionAssociation,
25
- ActiveRecord::Associations::Association
26
- ].each { |klass| klass.prepend(ArLazyPreload::Association) }
27
12
  end
File without changes
@@ -36,7 +36,6 @@ module ArLazyPreload
36
36
  end
37
37
 
38
38
  def lazy_preload!(*args)
39
- args.reject!(&:blank?)
40
39
  args.flatten!
41
40
  self.lazy_preload_values += args
42
41
  self
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ar_lazy_preload/active_record/base"
4
+ require "ar_lazy_preload/active_record/relation"
5
+ require "ar_lazy_preload/active_record/association"
6
+ require "ar_lazy_preload/active_record/merger"
7
+ require "ar_lazy_preload/active_record/association_relation"
8
+
9
+ module ArLazyPreload
10
+ class Railtie < Rails::Railtie
11
+ config.to_prepare do |_app|
12
+ ActiveSupport.on_load(:active_record) do
13
+ ActiveRecord::Base.include(Base)
14
+
15
+ ActiveRecord::Relation.prepend(Relation)
16
+ ActiveRecord::AssociationRelation.prepend(AssociationRelation)
17
+ ActiveRecord::Relation::Merger.prepend(Merger)
18
+
19
+ [
20
+ ActiveRecord::Associations::CollectionAssociation,
21
+ ActiveRecord::Associations::Association
22
+ ].each { |klass| klass.prepend(Association) }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ArLazyPreload
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  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.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - DmitryTsepelev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-18 00:00:00.000000000 Z
11
+ date: 2018-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -119,15 +119,16 @@ files:
119
119
  - README.md
120
120
  - Rakefile
121
121
  - lib/ar_lazy_preload.rb
122
+ - lib/ar_lazy_preload/active_record/association.rb
123
+ - lib/ar_lazy_preload/active_record/association_relation.rb
124
+ - lib/ar_lazy_preload/active_record/base.rb
125
+ - lib/ar_lazy_preload/active_record/merger.rb
126
+ - lib/ar_lazy_preload/active_record/relation.rb
122
127
  - lib/ar_lazy_preload/associated_context_builder.rb
123
128
  - lib/ar_lazy_preload/association_tree_builder.rb
124
129
  - lib/ar_lazy_preload/configuration.rb
125
130
  - lib/ar_lazy_preload/context.rb
126
- - lib/ar_lazy_preload/ext/association.rb
127
- - lib/ar_lazy_preload/ext/association_relation.rb
128
- - lib/ar_lazy_preload/ext/base.rb
129
- - lib/ar_lazy_preload/ext/merger.rb
130
- - lib/ar_lazy_preload/ext/relation.rb
131
+ - lib/ar_lazy_preload/railtie.rb
131
132
  - lib/ar_lazy_preload/version.rb
132
133
  homepage: https://github.com/DmitryTsepelev/ar_lazy_preload
133
134
  licenses: