n1_loader 1.7.1 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/n1_loader/active_record/associations_preloader_v5.rb +2 -2
  3. data/lib/n1_loader/active_record/associations_preloader_v6.rb +2 -2
  4. data/lib/n1_loader/active_record/associations_preloader_v7.rb +2 -2
  5. data/lib/n1_loader/ar_lazy_preload/loadable.rb +5 -14
  6. data/lib/n1_loader/ar_lazy_preload.rb +1 -1
  7. data/lib/n1_loader/core/loadable.rb +16 -59
  8. data/lib/n1_loader/core/loader.rb +8 -5
  9. data/lib/n1_loader/core/loader_builder.rb +16 -0
  10. data/lib/n1_loader/core/preloader.rb +5 -8
  11. data/lib/n1_loader/version.rb +1 -1
  12. data/lib/n1_loader.rb +1 -1
  13. metadata +3 -37
  14. data/.github/workflows/rubocop.yml +0 -24
  15. data/.github/workflows/tests.yml +0 -66
  16. data/.gitignore +0 -12
  17. data/.rspec +0 -3
  18. data/.rubocop.yml +0 -20
  19. data/CHANGELOG.md +0 -129
  20. data/CODE_OF_CONDUCT.md +0 -84
  21. data/Gemfile +0 -15
  22. data/LICENSE.txt +0 -21
  23. data/README.md +0 -276
  24. data/Rakefile +0 -12
  25. data/activerecord-gemfiles/ar_5_latest.gemfile +0 -3
  26. data/activerecord-gemfiles/ar_6_latest.gemfile +0 -3
  27. data/activerecord-gemfiles/ar_7_latest.gemfile +0 -3
  28. data/ar_lazy_preload-gemfiles/ar_lazy_preload_0.6.1.gemfile +0 -3
  29. data/ar_lazy_preload-gemfiles/ar_lazy_preload_master.gemfile +0 -3
  30. data/bin/console +0 -15
  31. data/bin/setup +0 -8
  32. data/examples/active_record_integration.rb +0 -33
  33. data/examples/ar_lazy_integration.rb +0 -36
  34. data/examples/ar_lazy_integration_with_isolated_loader.rb +0 -39
  35. data/examples/arguments_support.rb +0 -67
  36. data/examples/context/service.rb +0 -20
  37. data/examples/context/setup_ar_lazy.rb +0 -15
  38. data/examples/context/setup_database.rb +0 -26
  39. data/examples/core.rb +0 -39
  40. data/examples/graphql.rb +0 -63
  41. data/examples/isolated_loader.rb +0 -13
  42. data/examples/lazy_loading.rb +0 -26
  43. data/examples/reloading.rb +0 -32
  44. data/examples/shared_loader.rb +0 -34
  45. data/examples/single_case.rb +0 -34
  46. data/guides/enhanced-activerecord.md +0 -266
  47. data/lib/n1_loader/core/name.rb +0 -14
  48. data/n1_loader.gemspec +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35755dbc6a0ae17e636a26aaa99d903714a2e61248f60cc7a6c23f0d1ff5cbdd
4
- data.tar.gz: 34ebd3c7c2d873fb42fce414c74055251ef6169df1a06ec6255a857598c8fdf7
3
+ metadata.gz: 69bd23d2b22a8c7fccab4ca436c23079961fe20d5eb9eb5c9d5f9d6e9cfe6ab2
4
+ data.tar.gz: 8c7d60b0cb94207339ea697dc977d9669a5af9931b745bce889257535aaed109
5
5
  SHA512:
6
- metadata.gz: b4233a0b750ccfa3e001b512a379fb5a68758c45117fdaa0b5ec9cfd1c84d344c7e261ee61927794db2246aaa6c40b9576d5a19d1e547e65f6e08eab21de903d
7
- data.tar.gz: ee26e611bf87f7daf78912f01996bd7330a0dbb0d74e18a38af79b7f4869b6c43365694ef5f8597a8f1574e5cb16ff1ca4bf73421019215b29f139e4917510e9
6
+ metadata.gz: 340851e05310b0cfb05c9b8acd412d4bb1d06747e61e311008bd217bfead1aef6cc123bd3ca333a6bca025d0a367b2b0b4f589899438455cd9702ac6d79012c8
7
+ data.tar.gz: bdf43c35be906b011170d053ed050a60b7491087e10afde229510a10293df1d64e32a2a04d8c304611ae8a417c05568f7deda51a91b81b68820390a47dd824e7
@@ -24,11 +24,11 @@ module N1Loader
24
24
 
25
25
  def grouped_records(association, records)
26
26
  n1_load_records, records = records.partition do |record|
27
- record.class.respond_to?(:n1_loader_defined?) && record.class.n1_loader_defined?(association)
27
+ record.class.respond_to?(:n1_loaders) && record.class.n1_loaders.key?(association)
28
28
  end
29
29
 
30
30
  hash = n1_load_records.group_by do |record|
31
- N1LoaderReflection.new(association, record.class.n1_loader(association))
31
+ N1LoaderReflection.new(association, record.class.n1_loaders[association])
32
32
  end
33
33
 
34
34
  hash.merge(super)
@@ -18,11 +18,11 @@ module N1Loader
18
18
 
19
19
  def grouped_records(association, records, polymorphic_parent)
20
20
  n1_load_records, records = records.partition do |record|
21
- record.class.respond_to?(:n1_loader_defined?) && record.class.n1_loader_defined?(association)
21
+ record.class.respond_to?(:n1_loaders) && record.class.n1_loaders[association]
22
22
  end
23
23
 
24
24
  hash = n1_load_records.group_by do |record|
25
- N1LoaderReflection.new(association, record.class.n1_loader(association))
25
+ N1LoaderReflection.new(association, record.class.n1_loaders[association])
26
26
  end
27
27
 
28
28
  hash.merge(super)
@@ -18,11 +18,11 @@ module N1Loader
18
18
 
19
19
  def grouped_records # rubocop:disable Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/AbcSize
20
20
  n1_load_records, records = source_records.partition do |record|
21
- record.class.respond_to?(:n1_loader_defined?) && record.class.n1_loader_defined?(association)
21
+ record.class.respond_to?(:n1_loaders) && record.class.n1_loaders[association]
22
22
  end
23
23
 
24
24
  h = n1_load_records.group_by do |record|
25
- N1LoaderReflection.new(association, record.class.n1_loader(association))
25
+ N1LoaderReflection.new(association, record.class.n1_loaders[association])
26
26
  end
27
27
 
28
28
  polymorphic_parent = !root? && parent.polymorphic?
@@ -2,22 +2,13 @@
2
2
 
3
3
  module N1Loader
4
4
  module ArLazyPreload
5
- module Loadable
6
- module ClassMethods # :nodoc:
7
- def n1_optimized(name, loader = nil, &block)
8
- name, loader_name, loader_variable_name = super
5
+ module Loadable # :nodoc:
6
+ def n1_loader(name)
7
+ return n1_loaders[name] if n1_loaders[name]
9
8
 
10
- define_method(loader_name) do
11
- loader = instance_variable_get(loader_variable_name)
12
- return loader if loader
9
+ ContextAdapter.new(lazy_preload_context).try_preload_lazily(name) if respond_to?(:lazy_preload_context)
13
10
 
14
- if respond_to?(:lazy_preload_context) && ContextAdapter.new(lazy_preload_context).try_preload_lazily(name)
15
- return instance_variable_get(loader_variable_name)
16
- end
17
-
18
- send("#{loader_name}_reload")
19
- end
20
- end
11
+ super
21
12
  end
22
13
  end
23
14
  end
@@ -17,7 +17,7 @@ require_relative "ar_lazy_preload/loader_patch"
17
17
  require_relative "ar_lazy_preload/loader"
18
18
  require_relative "ar_lazy_preload/context"
19
19
 
20
- N1Loader::Loadable::ClassMethods.prepend(N1Loader::ArLazyPreload::Loadable::ClassMethods)
20
+ N1Loader::Loadable.prepend(N1Loader::ArLazyPreload::Loadable)
21
21
  N1Loader::Preloader.prepend(N1Loader::ArLazyPreload::PreloaderPatch)
22
22
  N1Loader::Loader.prepend(N1Loader::ArLazyPreload::LoaderPatch)
23
23
  N1Loader::LoaderCollection.prepend(N1Loader::ArLazyPreload::LoaderCollectionPatch)
@@ -7,14 +7,14 @@ module N1Loader
7
7
  # include N1Loader::Loadable
8
8
  #
9
9
  # # with inline loader
10
- # n1_loader :something do
10
+ # n1_optimized :something do
11
11
  # def perform(elements)
12
12
  # elements.each { |element| fulfill(element, element.calculate_something) }
13
13
  # end
14
14
  # end
15
15
  #
16
16
  # # with custom loader
17
- # n1_loader :something, MyLoader
17
+ # n1_optimized :something, MyLoader
18
18
  # end
19
19
  #
20
20
  # # custom loader
@@ -24,23 +24,21 @@ module N1Loader
24
24
  # end
25
25
  # end
26
26
  module Loadable
27
- include Name
27
+ def n1_loaders
28
+ @n1_loaders ||= {}
29
+ end
28
30
 
29
31
  def n1_loader(name)
30
- name = n1_loader_name(name)
31
-
32
- send("#{name}_loader")
32
+ n1_loaders[name]
33
33
  end
34
34
 
35
- def n1_loader_set(name, loader_collection)
36
- name = n1_loader_name(name)
37
-
38
- send("#{name}_loader=", loader_collection)
35
+ def n1_loader_reload(name)
36
+ n1_loaders[name] = LoaderCollection.new(self.class.n1_loaders[name], [self])
39
37
  end
40
38
 
41
39
  def n1_clear_cache
42
- self.class.n1_loaders.each do |name|
43
- n1_loader_set(name, nil)
40
+ self.class.n1_loaders.each_key do |name|
41
+ n1_loaders[name] = nil
44
42
  end
45
43
  end
46
44
 
@@ -49,61 +47,20 @@ module N1Loader
49
47
  end
50
48
 
51
49
  module ClassMethods # :nodoc:
52
- include Name
53
-
54
- def n1_loader(name)
55
- name = n1_loader_name(name)
56
-
57
- send("#{name}_loader")
58
- end
59
-
60
- def n1_loader_defined?(name)
61
- name = n1_loader_name(name)
62
-
63
- respond_to?("#{name}_loader")
64
- end
65
-
66
50
  def n1_loaders
67
- @n1_loaders ||= superclass.respond_to?(:n1_loaders) ? superclass.n1_loaders.dup : []
51
+ @n1_loaders ||= superclass.respond_to?(:n1_loaders) ? superclass.n1_loaders.dup : {}
68
52
  end
69
53
 
70
- def n1_optimized(name, loader = nil, &block) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
71
- loader ||= Class.new(N1Loader::Loader) do
72
- if block.arity == 1
73
- define_method(:perform, &block)
74
- else
75
- class_eval(&block)
76
- end
77
- end
78
- loader_name = "#{n1_loader_name(name)}_loader"
79
- loader_variable_name = "@#{loader_name}"
80
-
81
- n1_loaders << name
82
-
83
- define_singleton_method(loader_name) do
84
- loader
85
- end
86
-
87
- define_method("#{loader_name}_reload") do
88
- instance_variable_set(loader_variable_name,
89
- N1Loader::LoaderCollection.new(self.class.send(loader_name), [self]))
90
- end
54
+ def n1_optimized(name, loader = nil, &block)
55
+ loader ||= LoaderBuilder.build(&block)
91
56
 
92
- define_method("#{loader_name}=") do |loader_collection_instance|
93
- instance_variable_set(loader_variable_name, loader_collection_instance)
94
- end
95
-
96
- define_method(loader_name) do
97
- instance_variable_get(loader_variable_name) || send("#{loader_name}_reload")
98
- end
57
+ n1_loaders[name] = loader
99
58
 
100
59
  define_method(name) do |reload: false, **args|
101
- send("#{loader_name}_reload") if reload
60
+ n1_loader_reload(name) if reload || n1_loader(name).nil?
102
61
 
103
- send(loader_name).with(**args).for(self)
62
+ n1_loader(name).with(**args).for(self)
104
63
  end
105
-
106
- [name, loader_name, loader_variable_name]
107
64
  end
108
65
  end
109
66
  end
@@ -62,11 +62,10 @@ module N1Loader
62
62
 
63
63
  attr_reader :elements, :args
64
64
 
65
- def check_missing_arguments! # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
65
+ def check_missing_arguments!
66
66
  return unless (arguments = self.class.arguments)
67
67
 
68
- required_arguments = arguments.reject { |argument| argument[:optional] }
69
- .map { |argument| argument[:name] }
68
+ required_arguments = required_arguments(arguments)
70
69
 
71
70
  return if required_arguments.all? { |argument| args.key?(argument) }
72
71
 
@@ -74,8 +73,12 @@ module N1Loader
74
73
 
75
74
  list = missing_arguments.map { |argument| ":#{argument}" }.join(", ")
76
75
 
77
- raise MissingArgument,
78
- "Loader requires [#{list}] arguments but they are missing"
76
+ raise MissingArgument, "Loader requires [#{list}] arguments but they are missing"
77
+ end
78
+
79
+ def required_arguments(args)
80
+ args.reject { |argument| argument[:optional] }
81
+ .map { |argument| argument[:name] }
79
82
  end
80
83
 
81
84
  def check_arguments!
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module N1Loader
4
+ # The class builds {N1Loader::Loader}
5
+ class LoaderBuilder
6
+ def self.build(&block)
7
+ Class.new(N1Loader::Loader) do
8
+ if block.arity == 1
9
+ define_method(:perform, &block)
10
+ else
11
+ class_eval(&block)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -18,22 +18,19 @@ module N1Loader
18
18
  keys.flatten(1).flat_map do |key|
19
19
  elements
20
20
  .group_by { |element| loader_class(element, key) }
21
- .map do |loader_class, grouped_elements|
22
- next unless loader_class
23
-
21
+ .select { |loader_class, _| loader_class }
22
+ .map do |(loader_class, grouped_elements)|
24
23
  loader_collection = N1Loader::LoaderCollection.new(loader_class, grouped_elements)
25
- grouped_elements.each { |grouped_element| grouped_element.n1_loader_set(key, loader_collection) }
24
+ grouped_elements.each { |grouped_element| grouped_element.n1_loaders[key] = loader_collection }
26
25
  loader_collection
27
- end.compact
26
+ end
28
27
  end
29
28
  end
30
29
 
31
30
  private
32
31
 
33
32
  def loader_class(element, key)
34
- element.class.respond_to?(:n1_loader_defined?) &&
35
- element.class.n1_loader_defined?(key) &&
36
- element.class.n1_loader(key)
33
+ element.class.respond_to?(:n1_loaders) && element.class.n1_loaders[key]
37
34
  end
38
35
  end
39
36
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module N1Loader
4
- VERSION = "1.7.1"
4
+ VERSION = "1.7.3"
5
5
  end
data/lib/n1_loader.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "n1_loader/version"
4
4
 
5
- require_relative "n1_loader/core/name"
5
+ require_relative "n1_loader/core/loader_builder"
6
6
  require_relative "n1_loader/core/loader"
7
7
  require_relative "n1_loader/core/loader_collection"
8
8
  require_relative "n1_loader/core/loadable"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: n1_loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-30 00:00:00.000000000 Z
11
+ date: 2023-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -143,39 +143,6 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
- - ".github/workflows/rubocop.yml"
147
- - ".github/workflows/tests.yml"
148
- - ".gitignore"
149
- - ".rspec"
150
- - ".rubocop.yml"
151
- - CHANGELOG.md
152
- - CODE_OF_CONDUCT.md
153
- - Gemfile
154
- - LICENSE.txt
155
- - README.md
156
- - Rakefile
157
- - activerecord-gemfiles/ar_5_latest.gemfile
158
- - activerecord-gemfiles/ar_6_latest.gemfile
159
- - activerecord-gemfiles/ar_7_latest.gemfile
160
- - ar_lazy_preload-gemfiles/ar_lazy_preload_0.6.1.gemfile
161
- - ar_lazy_preload-gemfiles/ar_lazy_preload_master.gemfile
162
- - bin/console
163
- - bin/setup
164
- - examples/active_record_integration.rb
165
- - examples/ar_lazy_integration.rb
166
- - examples/ar_lazy_integration_with_isolated_loader.rb
167
- - examples/arguments_support.rb
168
- - examples/context/service.rb
169
- - examples/context/setup_ar_lazy.rb
170
- - examples/context/setup_database.rb
171
- - examples/core.rb
172
- - examples/graphql.rb
173
- - examples/isolated_loader.rb
174
- - examples/lazy_loading.rb
175
- - examples/reloading.rb
176
- - examples/shared_loader.rb
177
- - examples/single_case.rb
178
- - guides/enhanced-activerecord.md
179
146
  - lib/n1_loader.rb
180
147
  - lib/n1_loader/active_record.rb
181
148
  - lib/n1_loader/active_record/associations_preloader_v5.rb
@@ -195,11 +162,10 @@ files:
195
162
  - lib/n1_loader/ar_lazy_preload/preloader_patch.rb
196
163
  - lib/n1_loader/core/loadable.rb
197
164
  - lib/n1_loader/core/loader.rb
165
+ - lib/n1_loader/core/loader_builder.rb
198
166
  - lib/n1_loader/core/loader_collection.rb
199
- - lib/n1_loader/core/name.rb
200
167
  - lib/n1_loader/core/preloader.rb
201
168
  - lib/n1_loader/version.rb
202
- - n1_loader.gemspec
203
169
  homepage: https://github.com/djezzzl/n1_loader
204
170
  licenses:
205
171
  - MIT
@@ -1,24 +0,0 @@
1
- name: Rubocop
2
-
3
- on:
4
- pull_request:
5
- schedule:
6
- - cron: '0 0 * * 0'
7
-
8
- jobs:
9
- rubocop:
10
- runs-on: ubuntu-latest
11
-
12
- steps:
13
- - uses: actions/checkout@v3
14
-
15
- - name: Set up Ruby
16
- uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: 2.7
19
-
20
- - name: Install dependencies
21
- run: bundle install
22
-
23
- - name: Run Rubocop
24
- run: bundle exec rubocop
@@ -1,66 +0,0 @@
1
- name: RSpec tests
2
-
3
- on:
4
- pull_request:
5
- schedule:
6
- - cron: '0 0 * * 0'
7
-
8
- jobs:
9
- tests:
10
- runs-on: ubuntu-latest
11
-
12
- strategy:
13
- matrix:
14
- ruby-version:
15
- - '2.7'
16
- - '3.0'
17
- - 'head'
18
- activerecord-gemfile:
19
- - 'ar_5_latest'
20
- - 'ar_6_latest'
21
- - 'ar_7_latest'
22
- ar_lazy_preload-gemfile:
23
- - 'ar_lazy_preload_0.6.1'
24
- - 'ar_lazy_preload_master'
25
- exclude:
26
- - ruby-version: 'head'
27
- activerecord-gemfile: 'ar_5_latest'
28
-
29
- - ruby-version: 'head'
30
- activerecord-gemfile: 'ar_5_latest'
31
-
32
- - ruby-version: '3.0'
33
- activerecord-gemfile: 'ar_5_latest'
34
-
35
- - ruby-version: '3.0'
36
- activerecord-gemfile: 'ar_5_latest'
37
-
38
- - activerecord-gemfile: 'ar_7_latest'
39
- ar_lazy_preload-gemfile: 'ar_lazy_preload_0.6.1'
40
-
41
- - activerecord-gemfile: 'ar_5_latest'
42
- ar_lazy_preload-gemfile: 'ar_lazy_preload_master'
43
-
44
- env:
45
- ACTIVERECORD_GEMFILE: ${{ matrix.activerecord-gemfile }}
46
- AR_LAZY_PRELOAD_GEMFILE: ${{ matrix.ar_lazy_preload-gemfile }}
47
-
48
- steps:
49
- - uses: actions/checkout@v3
50
-
51
- - name: Set up Ruby ${{ matrix.ruby-version }}
52
- uses: ruby/setup-ruby@v1
53
- with:
54
- ruby-version: ${{ matrix.ruby-version }}
55
-
56
- - name: Install dependencies
57
- run: bundle install
58
-
59
- - name: Run Core tests
60
- run: bundle exec rspec spec/n1_loader_spec.rb
61
-
62
- - name: Run ActiveRecord tests
63
- run: bundle exec rspec spec/n1_loader_spec.rb spec/activerecord_spec.rb
64
-
65
- - name: Run ArLazyPreload tests
66
- run: bundle exec rspec spec/n1_loader_spec.rb spec/activerecord_spec.rb spec/ar_lazy_preload_spec.rb
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- /.idea
10
- .rspec_status
11
- Gemfile.lock
12
- .ruby-version
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,20 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 2.5
3
- Exclude:
4
- - examples/**/*
5
- - vendor/bundle/**/*
6
-
7
- Style/StringLiterals:
8
- Enabled: true
9
- EnforcedStyle: double_quotes
10
-
11
- Style/StringLiteralsInInterpolation:
12
- Enabled: true
13
- EnforcedStyle: double_quotes
14
-
15
- Layout/LineLength:
16
- Max: 120
17
-
18
- Metrics/BlockLength:
19
- Exclude:
20
- - spec/**/*
data/CHANGELOG.md DELETED
@@ -1,129 +0,0 @@
1
- ## [1.7.1] - 2023/07/30
2
-
3
- - Fix interface discrepancy for `N1LoaderReflection`. Thanks [Denis Talakevich](https://github.com/senid231) for suggesting it!
4
-
5
- ## [1.7.0] - 2023/07/30
6
-
7
- Extend the flexibility of loading data comparison. Thanks [Nazar Matus](https://github.com/FunkyloverOne) for suggesting it!
8
-
9
- **BREAKING CHANGES:**
10
-
11
- Loose comparison of loaded data. Before loaded data was initialized with identity comparator in mind:
12
-
13
- ```ruby
14
- @loaded = {}.compare_by_identity
15
- ```
16
-
17
- Now it will be:
18
-
19
- ```ruby
20
- @loaded = {}
21
- ```
22
-
23
- This might bring unwanted results for cases when strict comparison was wanted.
24
-
25
- On the other hand, it gives more flexibility for many other cases, especially with isolated loader.
26
- For example, this will work now, when it wasn't working before.
27
-
28
- ```ruby
29
- # ActiveRecord object
30
- object = Entity.first
31
-
32
- # Initialize isolated loader
33
- instance = loader.new([object])
34
-
35
- # This was working before because the loaded object is identical to passed object by `#object_id`
36
- instance.for(object)
37
-
38
- # This wasn't working before because the loaded object is not identical to passed one by `#object_id`
39
- #
40
- # But it will be working now, because object == Entity.find(object.id)
41
- instance.for(Entity.find(object.id))
42
- ```
43
-
44
- If you need strict comparison support, please feel free to open the issue or the PR.
45
-
46
- ## [1.6.6] - 2023/07/30
47
-
48
- - Fix naive check of required arguments. Thanks [Nazar Matus](https://github.com/FunkyloverOne) for the issue!
49
-
50
- ## [1.6.5] - 2023/07/30
51
-
52
- - Fix nested preloading for ActiveRecord 7. Thanks [Igor Gonchar](https://github.com/gigorok) for the issue!
53
-
54
- ## [1.6.4] - 2023/07/30
55
-
56
- - Add support of `n1_optimized` ending with `?` (question mark). Thanks [Ilya Kamenko](https://github.com/Galathius) for the suggestion!
57
-
58
- ## [1.6.3] - 2022/12/30
59
-
60
- - Performance optimization: avoid unnecessary calls. Thanks [Nazar Matus](https://github.com/FunkyloverOne) for the [contribution](https://github.com/djezzzl/n1_loader/pull/33).
61
-
62
- ## [1.6.2] - 2022/11/23
63
-
64
- - Add fund metadata
65
-
66
- ## [1.6.1] - 2022/10/29
67
-
68
- - Fix ArLazyPreload context setup when using isolated loaders for objects without the context.
69
-
70
- ## [1.6.0] - 2022/10/24
71
-
72
- - Add support of ArLazyPreload context for isolated loaders.
73
-
74
- ## [1.5.1] - 2022/09/20
75
-
76
- - Fix support of falsey value of arguments. Thanks [Aitor Lopez Beltran](https://github.com/aitorlb) for the [contribution](https://github.com/djezzzl/n1_loader/pull/23)!
77
-
78
- ## [1.5.0] - 2022/05/01
79
-
80
- - Add support of Rails 7
81
-
82
- ## [1.4.4] - 2022/04/29
83
-
84
- - Inject `N1Loader::Loadable` to `ActiveRecord::Base` automatically
85
- - Make `reload` to call `n1_clear_cache`
86
-
87
- ## [1.4.3] - 2022-04-13
88
-
89
- - Add `default` support to arguments
90
-
91
- ## [1.4.2] - 2022-03-01
92
-
93
- - Add n1_clear_cache method which is useful for cases like reload in ActiveRecord
94
-
95
- ## [1.4.1] - 2022-02-24
96
-
97
- - Fix preloading of invalid objects
98
-
99
- ## [1.4.0] - 2022-02-22
100
-
101
- - add support of optional arguments
102
-
103
- BREAKING CHANGES:
104
- - rework arguments to use single definition through `argument <name>` only
105
- - use keyword arguments
106
-
107
- ## [1.3.0] - 2022-02-22
108
-
109
- - add support of named arguments with `argument <name>`
110
-
111
- BREAKING CHANGES:
112
- - rename `n1_load` to `n1_optimized`
113
- - rework `def self.arguments_key` to `cache_key`
114
-
115
- ## [1.2.0] - 2022-01-14
116
-
117
- - Introduce arguments support.
118
-
119
- ## [1.1.0] - 2021-12-27
120
-
121
- - Introduce `fulfill` method to abstract the storage.
122
-
123
- ## [1.0.0] - 2021-12-26
124
-
125
- - Various of great features.
126
-
127
- ## [0.1.0] - 2021-12-16
128
-
129
- - Initial release.