chewy 7.3.0 → 7.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +4 -2
- data/lib/chewy/index/crutch.rb +15 -7
- data/lib/chewy/version.rb +1 -1
- data/lib/tasks/chewy.rake +1 -1
- data/spec/chewy/rake_helper_spec.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79428eb9af436a7a4c80a2db3c034583768eacc45d00074525f8e6559341ae20
|
4
|
+
data.tar.gz: 23377b8abb6ebfa81f8140990916022f8bbca769b5ad4474a076c8d890ece979
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89b6aa83fa54a6b5056623f8255eb34675ad9c3e1494915aa324af752d1a72f9c010fcbcbb3c929a232b32811bbc36956624848efabc09cb382c59fbcee54940
|
7
|
+
data.tar.gz: 90e1da06cf5c38903ca52c6b5379a9271cf277e3c70604b80d77d9ed13496b15ac3874249f2bf67fca7aec3eb9ac9db5e9a20de95eb1da7bb1bfa84307c9c846
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,13 @@
|
|
8
8
|
|
9
9
|
### Bugs Fixed
|
10
10
|
|
11
|
+
## 7.3.1 (2023-04-20)
|
12
|
+
|
13
|
+
### Bugs Fixed
|
14
|
+
|
15
|
+
* [#874](https://github.com/toptal/chewy/pull/874): Fix `chewy:journal:clean` task for ruby 3.x. ([@muk-ai](https://github.com/muk-ai))
|
16
|
+
* [#882](https://github.com/toptal/chewy/pull/882): Fix memory leak during `chewy:reset` for ruby 3.2 ([@konalegi](https://github.com/konalegi))
|
17
|
+
|
11
18
|
## 7.3.0 (2023-04-03)
|
12
19
|
|
13
20
|
### New Features
|
data/README.md
CHANGED
@@ -503,7 +503,7 @@ class ProductsIndex < Chewy::Index
|
|
503
503
|
|
504
504
|
field :name
|
505
505
|
# simply use crutch-fetched data as a value:
|
506
|
-
field :category_names, value: ->(product, crutches) { crutches
|
506
|
+
field :category_names, value: ->(product, crutches) { crutches[:categories][product.id] }
|
507
507
|
end
|
508
508
|
```
|
509
509
|
|
@@ -884,7 +884,9 @@ It is convenient for use in e.g. the Rails console with non-block notation:
|
|
884
884
|
|
885
885
|
#### `:bypass`
|
886
886
|
|
887
|
-
|
887
|
+
When the bypass strategy is active the index will not be automatically updated on object save.
|
888
|
+
|
889
|
+
For example, on `City.first.save!` the cities index would not be updated.
|
888
890
|
|
889
891
|
#### Nesting
|
890
892
|
|
data/lib/chewy/index/crutch.rb
CHANGED
@@ -12,13 +12,21 @@ module Chewy
|
|
12
12
|
def initialize(index, collection)
|
13
13
|
@index = index
|
14
14
|
@collection = collection
|
15
|
-
@
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
@crutches_instances = {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def method_missing(name, *, **)
|
19
|
+
return self[name] if @index._crutches.key?(name)
|
20
|
+
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def respond_to_missing?(name, include_private = false)
|
25
|
+
@index._crutches.key?(name) || super
|
26
|
+
end
|
27
|
+
|
28
|
+
def [](name)
|
29
|
+
@crutches_instances[name] ||= @index._crutches[:"#{name}"].call(@collection)
|
22
30
|
end
|
23
31
|
end
|
24
32
|
|
data/lib/chewy/version.rb
CHANGED
data/lib/tasks/chewy.rake
CHANGED
@@ -96,7 +96,7 @@ namespace :chewy do
|
|
96
96
|
task clean: :environment do |_task, args|
|
97
97
|
delete_options = Chewy::RakeHelper.delete_by_query_options_from_env(ENV)
|
98
98
|
Chewy::RakeHelper.journal_clean(
|
99
|
-
[
|
99
|
+
**[
|
100
100
|
parse_journal_args(args.extras),
|
101
101
|
{delete_by_query_options: delete_options}
|
102
102
|
].reduce({}, :merge)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'rake'
|
2
3
|
|
3
4
|
describe Chewy::RakeHelper, :orm do
|
4
5
|
before { Chewy.massacre }
|
@@ -456,6 +457,17 @@ Total: \\d+s\\Z
|
|
456
457
|
Total: \\d+s\\Z
|
457
458
|
OUTPUT
|
458
459
|
end
|
460
|
+
|
461
|
+
context 'execute "chewy:journal:clean" rake task' do
|
462
|
+
subject(:task) { Rake.application['chewy:journal:clean'] }
|
463
|
+
before do
|
464
|
+
Rake::DefaultLoader.new.load('lib/tasks/chewy.rake')
|
465
|
+
Rake::Task.define_task(:environment)
|
466
|
+
end
|
467
|
+
it 'does not raise error' do
|
468
|
+
expect { task.invoke }.to_not raise_error
|
469
|
+
end
|
470
|
+
end
|
459
471
|
end
|
460
472
|
|
461
473
|
describe '.reindex' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chewy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.3.
|
4
|
+
version: 7.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toptal, LLC
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-04-
|
12
|
+
date: 2023-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: database_cleaner
|