esse-active_record 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36873df931f4f1169fefa6e411417b4639218af434ccad541d851cb3a060dcfe
4
- data.tar.gz: 500b9266326fd5bea838c09b06f836e6f3f20a9c7482df1dd392ab64759ac71d
3
+ metadata.gz: d6ec661a171ddf9df565e1da2c3ca67bc34fc18ec957e47867e50b043ce0ee44
4
+ data.tar.gz: 29e7acc6af3e77bbe52dde14038de3ad82532964dbc7293cdc77f2a3ae4764a3
5
5
  SHA512:
6
- metadata.gz: cac26d6c6d3c13e0081989925e695b64beaf968409644ed3b45ca8a771c7bc0df3fc22a35762adb94a0b1505e82df3f4541eaf18c3dffc45766867f2bb7428f0
7
- data.tar.gz: a65f7bbb4329e39ebc463f2b6342c113fcf42f444879fdefe765db37aabd30fb49905b2521533d323765af44643fca5c27c2156de891bc1fbfe10a00cb3653a6
6
+ metadata.gz: cc76722e48a2ea6e002b08dd9f29b53bed75cf4f857254dde166bfc30090fc16482e3b70fe47dbc7409e970dfb5d47b5dcefcc5bf413d56382f5e9a909e98837
7
+ data.tar.gz: 76dcbec4c950921945faa13785273e523d82644d3757d3b27ee91f352f155371b218f9f1ff40b079cd04ad722acedf8c873b01532dc9143249b0616636b98b0e
data/.rubocop.yml CHANGED
@@ -28,9 +28,6 @@ RSpec/ExampleLength:
28
28
  RSpec/MessageSpies:
29
29
  Enabled: false
30
30
 
31
- RSpec/FilePath:
32
- Enabled: false
33
-
34
31
  Layout/SpaceInsideHashLiteralBraces:
35
32
  Enabled: false
36
33
 
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
 
5
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
- gem 'esse', '~> 0.3.1'
7
+ gem 'esse', '~> 0.3.4'
8
8
  gem 'sqlite3', '~> 1.7.3'
9
9
  gem 'activerecord', '~> 5.2'
10
10
  gem 'esse-rspec', '~> 0.0.6'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- esse-active_record (0.3.4)
4
+ esse-active_record (0.3.6)
5
5
  activerecord (>= 4.2, < 8)
6
6
  esse (>= 0.3.0)
7
7
 
@@ -39,7 +39,7 @@ GEM
39
39
  elasticsearch-transport (7.17.10)
40
40
  faraday (>= 1, < 3)
41
41
  multi_json
42
- esse (0.3.1)
42
+ esse (0.3.4)
43
43
  multi_json
44
44
  thor (>= 0.19)
45
45
  esse-rspec (0.0.6)
@@ -142,7 +142,7 @@ DEPENDENCIES
142
142
  awesome_print
143
143
  dotenv
144
144
  elasticsearch (~> 7.17, >= 7.17.10)
145
- esse (~> 0.3.1)
145
+ esse (~> 0.3.4)
146
146
  esse-active_record!
147
147
  esse-rspec (~> 0.0.6)
148
148
  pry
data/README.md CHANGED
@@ -210,6 +210,35 @@ User.without_indexing(AccountsIndex) do
210
210
  end
211
211
  ```
212
212
 
213
+ ### Asynchronous Indexing
214
+
215
+ If you are using a background job processor like Sidekiq or Faktory, you may be interested in indexing documents asynchronously. For this, you can use the [esse-async_indexing](https://github.com/marcosgz/esse-async_indexing) gem.
216
+
217
+ Add the `esse-async_indexing` gem to your Gemfile and require the `esse/async_indexing/active_record` file in your application initialization. Make sure to setup the gem configurationg according to the [esse-async_indexing documentation](https://github.com/marcosgz/esse-async_indexing).
218
+
219
+
220
+ ```ruby
221
+ require 'esse/async_indexing/active_record'
222
+ ```
223
+
224
+ Then, you can use the `async_index_callback` or `async_update_lazy_attribute_callback` methods to push the indexing job to the background job processor.
225
+
226
+ ```diff
227
+ class City < ApplicationRecord
228
+ include Esse::ActiveRecord::Model
229
+ - include Esse::ActiveRecord::Model
230
+ + include Esse::AsyncIndexing::ActiveRecord::Model
231
+
232
+ belongs_to :state, optional: true
233
+
234
+
235
+ async_indexing_callback('geos_index:city') { id }
236
+ - index_callback('geos_index:city') { id }
237
+ - update_lazy_attribute_callback('geos_index:state', 'cities_count', if: :state_id?) { state_id }
238
+ + async_index_callback('geos_index:city', service_name: :sidekiq) { id }
239
+ + async_update_lazy_attribute_callback('geos_index:state', 'cities_count', if: :state_id?, service_name: :sidekiq) { state_id }
240
+ end
241
+ ```
213
242
 
214
243
  ## Development
215
244
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- esse-active_record (0.3.4)
4
+ esse-active_record (0.3.6)
5
5
  activerecord (>= 4.2, < 8)
6
6
  esse (>= 0.3.0)
7
7
 
@@ -19,27 +19,30 @@ GEM
19
19
  i18n (>= 0.7, < 2)
20
20
  minitest (~> 5.1)
21
21
  tzinfo (~> 1.1)
22
- addressable (2.8.6)
23
- public_suffix (>= 2.0.2, < 6.0)
22
+ addressable (2.8.7)
23
+ public_suffix (>= 2.0.2, < 7.0)
24
24
  arel (9.0.0)
25
25
  ast (2.4.2)
26
26
  awesome_print (1.9.2)
27
27
  base64 (0.2.0)
28
+ bigdecimal (3.1.8)
28
29
  coderay (1.1.3)
29
- concurrent-ruby (1.2.3)
30
- crack (0.4.5)
30
+ concurrent-ruby (1.3.3)
31
+ crack (1.0.0)
32
+ bigdecimal
31
33
  rexml
32
- diff-lcs (1.5.0)
34
+ diff-lcs (1.5.1)
33
35
  dotenv (2.8.1)
34
- elasticsearch (7.17.10)
35
- elasticsearch-api (= 7.17.10)
36
- elasticsearch-transport (= 7.17.10)
37
- elasticsearch-api (7.17.10)
36
+ elasticsearch (7.17.11)
37
+ elasticsearch-api (= 7.17.11)
38
+ elasticsearch-transport (= 7.17.11)
39
+ elasticsearch-api (7.17.11)
38
40
  multi_json
39
- elasticsearch-transport (7.17.10)
41
+ elasticsearch-transport (7.17.11)
42
+ base64
40
43
  faraday (>= 1, < 3)
41
44
  multi_json
42
- esse (0.3.0)
45
+ esse (0.3.4)
43
46
  multi_json
44
47
  thor (>= 0.19)
45
48
  esse-rspec (0.0.6)
@@ -51,89 +54,85 @@ GEM
51
54
  ruby2_keywords (>= 0.0.4)
52
55
  faraday-net_http (3.0.2)
53
56
  hashdiff (1.1.0)
54
- i18n (1.14.1)
57
+ i18n (1.14.5)
55
58
  concurrent-ruby (~> 1.0)
56
- json (2.7.1)
59
+ json (2.7.2)
57
60
  language_server-protocol (3.17.0.3)
58
61
  lint_roller (1.1.0)
59
- method_source (1.0.0)
60
- minitest (5.21.2)
62
+ method_source (1.1.0)
63
+ minitest (5.24.1)
61
64
  multi_json (1.15.0)
62
- parallel (1.24.0)
63
- parser (3.3.0.5)
65
+ parallel (1.25.1)
66
+ parser (3.3.4.0)
64
67
  ast (~> 2.4.1)
65
68
  racc
66
69
  pry (0.14.2)
67
70
  coderay (~> 1.1)
68
71
  method_source (~> 1.0)
69
- public_suffix (5.0.4)
70
- racc (1.7.3)
72
+ public_suffix (5.1.1)
73
+ racc (1.8.0)
71
74
  rainbow (3.1.1)
72
- rake (13.1.0)
73
- regexp_parser (2.9.0)
74
- rexml (3.2.6)
75
- rspec (3.12.0)
76
- rspec-core (~> 3.12.0)
77
- rspec-expectations (~> 3.12.0)
78
- rspec-mocks (~> 3.12.0)
79
- rspec-core (3.12.2)
80
- rspec-support (~> 3.12.0)
81
- rspec-expectations (3.12.3)
75
+ rake (13.2.1)
76
+ regexp_parser (2.9.2)
77
+ rexml (3.3.2)
78
+ strscan
79
+ rspec (3.13.0)
80
+ rspec-core (~> 3.13.0)
81
+ rspec-expectations (~> 3.13.0)
82
+ rspec-mocks (~> 3.13.0)
83
+ rspec-core (3.13.0)
84
+ rspec-support (~> 3.13.0)
85
+ rspec-expectations (3.13.1)
82
86
  diff-lcs (>= 1.2.0, < 2.0)
83
- rspec-support (~> 3.12.0)
84
- rspec-mocks (3.12.6)
87
+ rspec-support (~> 3.13.0)
88
+ rspec-mocks (3.13.1)
85
89
  diff-lcs (>= 1.2.0, < 2.0)
86
- rspec-support (~> 3.12.0)
87
- rspec-support (3.12.1)
88
- rubocop (1.59.0)
90
+ rspec-support (~> 3.13.0)
91
+ rspec-support (3.13.1)
92
+ rubocop (1.64.1)
89
93
  json (~> 2.3)
90
94
  language_server-protocol (>= 3.17.0)
91
95
  parallel (~> 1.10)
92
- parser (>= 3.2.2.4)
96
+ parser (>= 3.3.0.2)
93
97
  rainbow (>= 2.2.2, < 4.0)
94
98
  regexp_parser (>= 1.8, < 3.0)
95
99
  rexml (>= 3.2.5, < 4.0)
96
- rubocop-ast (>= 1.30.0, < 2.0)
100
+ rubocop-ast (>= 1.31.1, < 2.0)
97
101
  ruby-progressbar (~> 1.7)
98
102
  unicode-display_width (>= 2.4.0, < 3.0)
99
- rubocop-ast (1.30.0)
100
- parser (>= 3.2.1.0)
101
- rubocop-capybara (2.20.0)
102
- rubocop (~> 1.41)
103
- rubocop-factory_bot (2.25.1)
104
- rubocop (~> 1.41)
105
- rubocop-performance (1.20.2)
103
+ rubocop-ast (1.31.3)
104
+ parser (>= 3.3.1.0)
105
+ rubocop-performance (1.21.1)
106
106
  rubocop (>= 1.48.1, < 2.0)
107
- rubocop-ast (>= 1.30.0, < 2.0)
108
- rubocop-rspec (2.26.1)
109
- rubocop (~> 1.40)
110
- rubocop-capybara (~> 2.17)
111
- rubocop-factory_bot (~> 2.22)
107
+ rubocop-ast (>= 1.31.1, < 2.0)
108
+ rubocop-rspec (3.0.3)
109
+ rubocop (~> 1.61)
112
110
  ruby-progressbar (1.13.0)
113
111
  ruby2_keywords (0.0.5)
114
112
  sqlite3 (1.3.13)
115
- standard (1.33.0)
113
+ standard (1.37.0)
116
114
  language_server-protocol (~> 3.17.0.2)
117
115
  lint_roller (~> 1.0)
118
- rubocop (~> 1.59.0)
116
+ rubocop (~> 1.64.0)
119
117
  standard-custom (~> 1.0.0)
120
- standard-performance (~> 1.3)
118
+ standard-performance (~> 1.4)
121
119
  standard-custom (1.0.2)
122
120
  lint_roller (~> 1.0)
123
121
  rubocop (~> 1.50)
124
- standard-performance (1.3.1)
122
+ standard-performance (1.4.0)
125
123
  lint_roller (~> 1.1)
126
- rubocop-performance (~> 1.20.2)
127
- thor (1.3.0)
124
+ rubocop-performance (~> 1.21.0)
125
+ strscan (3.1.0)
126
+ thor (1.3.1)
128
127
  thread_safe (0.3.6)
129
128
  tzinfo (1.2.11)
130
129
  thread_safe (~> 0.1)
131
130
  unicode-display_width (2.5.0)
132
- webmock (3.19.1)
131
+ webmock (3.23.1)
133
132
  addressable (>= 2.8.0)
134
133
  crack (>= 0.3.2)
135
134
  hashdiff (>= 0.4.0, < 2.0.0)
136
- yard (0.9.34)
135
+ yard (0.9.36)
137
136
 
138
137
  PLATFORMS
139
138
  x86_64-linux
@@ -1,136 +1,139 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- esse-active_record (0.3.4)
4
+ esse-active_record (0.3.6)
5
5
  activerecord (>= 4.2, < 8)
6
6
  esse (>= 0.3.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (6.1.7.6)
12
- activesupport (= 6.1.7.6)
13
- activerecord (6.1.7.6)
14
- activemodel (= 6.1.7.6)
15
- activesupport (= 6.1.7.6)
16
- activesupport (6.1.7.6)
11
+ activemodel (6.1.7.8)
12
+ activesupport (= 6.1.7.8)
13
+ activerecord (6.1.7.8)
14
+ activemodel (= 6.1.7.8)
15
+ activesupport (= 6.1.7.8)
16
+ activesupport (6.1.7.8)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 1.6, < 2)
19
19
  minitest (>= 5.1)
20
20
  tzinfo (~> 2.0)
21
21
  zeitwerk (~> 2.3)
22
- addressable (2.8.6)
23
- public_suffix (>= 2.0.2, < 6.0)
22
+ addressable (2.8.7)
23
+ public_suffix (>= 2.0.2, < 7.0)
24
24
  ast (2.4.2)
25
25
  awesome_print (1.9.2)
26
+ base64 (0.2.0)
27
+ bigdecimal (3.1.8)
26
28
  coderay (1.1.3)
27
- concurrent-ruby (1.2.3)
28
- crack (0.4.5)
29
+ concurrent-ruby (1.3.3)
30
+ crack (1.0.0)
31
+ bigdecimal
29
32
  rexml
30
- diff-lcs (1.5.0)
33
+ diff-lcs (1.5.1)
31
34
  dotenv (2.8.1)
32
- elasticsearch (7.17.10)
33
- elasticsearch-api (= 7.17.10)
34
- elasticsearch-transport (= 7.17.10)
35
- elasticsearch-api (7.17.10)
35
+ elasticsearch (7.17.11)
36
+ elasticsearch-api (= 7.17.11)
37
+ elasticsearch-transport (= 7.17.11)
38
+ elasticsearch-api (7.17.11)
36
39
  multi_json
37
- elasticsearch-transport (7.17.10)
40
+ elasticsearch-transport (7.17.11)
41
+ base64
38
42
  faraday (>= 1, < 3)
39
43
  multi_json
40
- esse (0.3.0)
44
+ esse (0.3.4)
41
45
  multi_json
42
46
  thor (>= 0.19)
43
47
  esse-rspec (0.0.6)
44
48
  esse (>= 0.2.4)
45
49
  rspec (>= 3)
46
- faraday (2.0.0)
50
+ faraday (2.8.1)
51
+ base64
52
+ faraday-net_http (>= 2.0, < 3.1)
47
53
  ruby2_keywords (>= 0.0.4)
54
+ faraday-net_http (3.0.2)
48
55
  hashdiff (1.1.0)
49
- i18n (1.14.1)
56
+ i18n (1.14.5)
50
57
  concurrent-ruby (~> 1.0)
51
- json (2.7.1)
58
+ json (2.7.2)
52
59
  language_server-protocol (3.17.0.3)
53
60
  lint_roller (1.1.0)
54
- method_source (1.0.0)
61
+ method_source (1.1.0)
55
62
  mini_portile2 (2.8.7)
56
- minitest (5.21.2)
63
+ minitest (5.24.1)
57
64
  multi_json (1.15.0)
58
- parallel (1.24.0)
59
- parser (3.3.0.5)
65
+ parallel (1.25.1)
66
+ parser (3.3.4.0)
60
67
  ast (~> 2.4.1)
61
68
  racc
62
69
  pry (0.14.2)
63
70
  coderay (~> 1.1)
64
71
  method_source (~> 1.0)
65
- public_suffix (5.0.4)
66
- racc (1.7.3)
72
+ public_suffix (5.1.1)
73
+ racc (1.8.0)
67
74
  rainbow (3.1.1)
68
- rake (13.1.0)
69
- regexp_parser (2.9.0)
70
- rexml (3.2.6)
71
- rspec (3.12.0)
72
- rspec-core (~> 3.12.0)
73
- rspec-expectations (~> 3.12.0)
74
- rspec-mocks (~> 3.12.0)
75
- rspec-core (3.12.2)
76
- rspec-support (~> 3.12.0)
77
- rspec-expectations (3.12.3)
75
+ rake (13.2.1)
76
+ regexp_parser (2.9.2)
77
+ rexml (3.3.2)
78
+ strscan
79
+ rspec (3.13.0)
80
+ rspec-core (~> 3.13.0)
81
+ rspec-expectations (~> 3.13.0)
82
+ rspec-mocks (~> 3.13.0)
83
+ rspec-core (3.13.0)
84
+ rspec-support (~> 3.13.0)
85
+ rspec-expectations (3.13.1)
78
86
  diff-lcs (>= 1.2.0, < 2.0)
79
- rspec-support (~> 3.12.0)
80
- rspec-mocks (3.12.6)
87
+ rspec-support (~> 3.13.0)
88
+ rspec-mocks (3.13.1)
81
89
  diff-lcs (>= 1.2.0, < 2.0)
82
- rspec-support (~> 3.12.0)
83
- rspec-support (3.12.1)
84
- rubocop (1.59.0)
90
+ rspec-support (~> 3.13.0)
91
+ rspec-support (3.13.1)
92
+ rubocop (1.64.1)
85
93
  json (~> 2.3)
86
94
  language_server-protocol (>= 3.17.0)
87
95
  parallel (~> 1.10)
88
- parser (>= 3.2.2.4)
96
+ parser (>= 3.3.0.2)
89
97
  rainbow (>= 2.2.2, < 4.0)
90
98
  regexp_parser (>= 1.8, < 3.0)
91
99
  rexml (>= 3.2.5, < 4.0)
92
- rubocop-ast (>= 1.30.0, < 2.0)
100
+ rubocop-ast (>= 1.31.1, < 2.0)
93
101
  ruby-progressbar (~> 1.7)
94
102
  unicode-display_width (>= 2.4.0, < 3.0)
95
- rubocop-ast (1.30.0)
96
- parser (>= 3.2.1.0)
97
- rubocop-capybara (2.20.0)
98
- rubocop (~> 1.41)
99
- rubocop-factory_bot (2.25.1)
100
- rubocop (~> 1.41)
101
- rubocop-performance (1.20.2)
103
+ rubocop-ast (1.31.3)
104
+ parser (>= 3.3.1.0)
105
+ rubocop-performance (1.21.1)
102
106
  rubocop (>= 1.48.1, < 2.0)
103
- rubocop-ast (>= 1.30.0, < 2.0)
104
- rubocop-rspec (2.26.1)
105
- rubocop (~> 1.40)
106
- rubocop-capybara (~> 2.17)
107
- rubocop-factory_bot (~> 2.22)
107
+ rubocop-ast (>= 1.31.1, < 2.0)
108
+ rubocop-rspec (3.0.3)
109
+ rubocop (~> 1.61)
108
110
  ruby-progressbar (1.13.0)
109
111
  ruby2_keywords (0.0.5)
110
112
  sqlite3 (1.7.3)
111
113
  mini_portile2 (~> 2.8.0)
112
- standard (1.33.0)
114
+ standard (1.37.0)
113
115
  language_server-protocol (~> 3.17.0.2)
114
116
  lint_roller (~> 1.0)
115
- rubocop (~> 1.59.0)
117
+ rubocop (~> 1.64.0)
116
118
  standard-custom (~> 1.0.0)
117
- standard-performance (~> 1.3)
119
+ standard-performance (~> 1.4)
118
120
  standard-custom (1.0.2)
119
121
  lint_roller (~> 1.0)
120
122
  rubocop (~> 1.50)
121
- standard-performance (1.3.1)
123
+ standard-performance (1.4.0)
122
124
  lint_roller (~> 1.1)
123
- rubocop-performance (~> 1.20.2)
124
- thor (1.3.0)
125
+ rubocop-performance (~> 1.21.0)
126
+ strscan (3.1.0)
127
+ thor (1.3.1)
125
128
  tzinfo (2.0.6)
126
129
  concurrent-ruby (~> 1.0)
127
130
  unicode-display_width (2.5.0)
128
- webmock (3.19.1)
131
+ webmock (3.23.1)
129
132
  addressable (>= 2.8.0)
130
133
  crack (>= 0.3.2)
131
134
  hashdiff (>= 0.4.0, < 2.0.0)
132
- yard (0.9.34)
133
- zeitwerk (2.6.12)
135
+ yard (0.9.36)
136
+ zeitwerk (2.6.16)
134
137
 
135
138
  PLATFORMS
136
139
  x86_64-linux
@@ -1,136 +1,139 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- esse-active_record (0.3.4)
4
+ esse-active_record (0.3.6)
5
5
  activerecord (>= 4.2, < 8)
6
6
  esse (>= 0.3.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (6.1.7.6)
12
- activesupport (= 6.1.7.6)
13
- activerecord (6.1.7.6)
14
- activemodel (= 6.1.7.6)
15
- activesupport (= 6.1.7.6)
16
- activesupport (6.1.7.6)
11
+ activemodel (6.1.7.8)
12
+ activesupport (= 6.1.7.8)
13
+ activerecord (6.1.7.8)
14
+ activemodel (= 6.1.7.8)
15
+ activesupport (= 6.1.7.8)
16
+ activesupport (6.1.7.8)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 1.6, < 2)
19
19
  minitest (>= 5.1)
20
20
  tzinfo (~> 2.0)
21
21
  zeitwerk (~> 2.3)
22
- addressable (2.8.6)
23
- public_suffix (>= 2.0.2, < 6.0)
22
+ addressable (2.8.7)
23
+ public_suffix (>= 2.0.2, < 7.0)
24
24
  ast (2.4.2)
25
25
  awesome_print (1.9.2)
26
+ base64 (0.2.0)
27
+ bigdecimal (3.1.8)
26
28
  coderay (1.1.3)
27
- concurrent-ruby (1.2.3)
28
- crack (0.4.5)
29
+ concurrent-ruby (1.3.3)
30
+ crack (1.0.0)
31
+ bigdecimal
29
32
  rexml
30
- diff-lcs (1.5.0)
33
+ diff-lcs (1.5.1)
31
34
  dotenv (2.8.1)
32
- elasticsearch (7.17.10)
33
- elasticsearch-api (= 7.17.10)
34
- elasticsearch-transport (= 7.17.10)
35
- elasticsearch-api (7.17.10)
35
+ elasticsearch (7.17.11)
36
+ elasticsearch-api (= 7.17.11)
37
+ elasticsearch-transport (= 7.17.11)
38
+ elasticsearch-api (7.17.11)
36
39
  multi_json
37
- elasticsearch-transport (7.17.10)
40
+ elasticsearch-transport (7.17.11)
41
+ base64
38
42
  faraday (>= 1, < 3)
39
43
  multi_json
40
- esse (0.3.0)
44
+ esse (0.3.4)
41
45
  multi_json
42
46
  thor (>= 0.19)
43
47
  esse-rspec (0.0.6)
44
48
  esse (>= 0.2.4)
45
49
  rspec (>= 3)
46
- faraday (2.0.0)
50
+ faraday (2.8.1)
51
+ base64
52
+ faraday-net_http (>= 2.0, < 3.1)
47
53
  ruby2_keywords (>= 0.0.4)
54
+ faraday-net_http (3.0.2)
48
55
  hashdiff (1.1.0)
49
- i18n (1.14.1)
56
+ i18n (1.14.5)
50
57
  concurrent-ruby (~> 1.0)
51
- json (2.7.1)
58
+ json (2.7.2)
52
59
  language_server-protocol (3.17.0.3)
53
60
  lint_roller (1.1.0)
54
- method_source (1.0.0)
61
+ method_source (1.1.0)
55
62
  mini_portile2 (2.8.7)
56
- minitest (5.21.2)
63
+ minitest (5.24.1)
57
64
  multi_json (1.15.0)
58
- parallel (1.24.0)
59
- parser (3.3.0.5)
65
+ parallel (1.25.1)
66
+ parser (3.3.4.0)
60
67
  ast (~> 2.4.1)
61
68
  racc
62
69
  pry (0.14.2)
63
70
  coderay (~> 1.1)
64
71
  method_source (~> 1.0)
65
- public_suffix (5.0.4)
66
- racc (1.7.3)
72
+ public_suffix (5.1.1)
73
+ racc (1.8.0)
67
74
  rainbow (3.1.1)
68
- rake (13.1.0)
69
- regexp_parser (2.9.0)
70
- rexml (3.2.6)
71
- rspec (3.12.0)
72
- rspec-core (~> 3.12.0)
73
- rspec-expectations (~> 3.12.0)
74
- rspec-mocks (~> 3.12.0)
75
- rspec-core (3.12.2)
76
- rspec-support (~> 3.12.0)
77
- rspec-expectations (3.12.3)
75
+ rake (13.2.1)
76
+ regexp_parser (2.9.2)
77
+ rexml (3.3.2)
78
+ strscan
79
+ rspec (3.13.0)
80
+ rspec-core (~> 3.13.0)
81
+ rspec-expectations (~> 3.13.0)
82
+ rspec-mocks (~> 3.13.0)
83
+ rspec-core (3.13.0)
84
+ rspec-support (~> 3.13.0)
85
+ rspec-expectations (3.13.1)
78
86
  diff-lcs (>= 1.2.0, < 2.0)
79
- rspec-support (~> 3.12.0)
80
- rspec-mocks (3.12.6)
87
+ rspec-support (~> 3.13.0)
88
+ rspec-mocks (3.13.1)
81
89
  diff-lcs (>= 1.2.0, < 2.0)
82
- rspec-support (~> 3.12.0)
83
- rspec-support (3.12.1)
84
- rubocop (1.59.0)
90
+ rspec-support (~> 3.13.0)
91
+ rspec-support (3.13.1)
92
+ rubocop (1.64.1)
85
93
  json (~> 2.3)
86
94
  language_server-protocol (>= 3.17.0)
87
95
  parallel (~> 1.10)
88
- parser (>= 3.2.2.4)
96
+ parser (>= 3.3.0.2)
89
97
  rainbow (>= 2.2.2, < 4.0)
90
98
  regexp_parser (>= 1.8, < 3.0)
91
99
  rexml (>= 3.2.5, < 4.0)
92
- rubocop-ast (>= 1.30.0, < 2.0)
100
+ rubocop-ast (>= 1.31.1, < 2.0)
93
101
  ruby-progressbar (~> 1.7)
94
102
  unicode-display_width (>= 2.4.0, < 3.0)
95
- rubocop-ast (1.30.0)
96
- parser (>= 3.2.1.0)
97
- rubocop-capybara (2.20.0)
98
- rubocop (~> 1.41)
99
- rubocop-factory_bot (2.25.1)
100
- rubocop (~> 1.41)
101
- rubocop-performance (1.20.2)
103
+ rubocop-ast (1.31.3)
104
+ parser (>= 3.3.1.0)
105
+ rubocop-performance (1.21.1)
102
106
  rubocop (>= 1.48.1, < 2.0)
103
- rubocop-ast (>= 1.30.0, < 2.0)
104
- rubocop-rspec (2.26.1)
105
- rubocop (~> 1.40)
106
- rubocop-capybara (~> 2.17)
107
- rubocop-factory_bot (~> 2.22)
107
+ rubocop-ast (>= 1.31.1, < 2.0)
108
+ rubocop-rspec (3.0.3)
109
+ rubocop (~> 1.61)
108
110
  ruby-progressbar (1.13.0)
109
111
  ruby2_keywords (0.0.5)
110
112
  sqlite3 (1.7.3)
111
113
  mini_portile2 (~> 2.8.0)
112
- standard (1.33.0)
114
+ standard (1.37.0)
113
115
  language_server-protocol (~> 3.17.0.2)
114
116
  lint_roller (~> 1.0)
115
- rubocop (~> 1.59.0)
117
+ rubocop (~> 1.64.0)
116
118
  standard-custom (~> 1.0.0)
117
- standard-performance (~> 1.3)
119
+ standard-performance (~> 1.4)
118
120
  standard-custom (1.0.2)
119
121
  lint_roller (~> 1.0)
120
122
  rubocop (~> 1.50)
121
- standard-performance (1.3.1)
123
+ standard-performance (1.4.0)
122
124
  lint_roller (~> 1.1)
123
- rubocop-performance (~> 1.20.2)
124
- thor (1.3.0)
125
+ rubocop-performance (~> 1.21.0)
126
+ strscan (3.1.0)
127
+ thor (1.3.1)
125
128
  tzinfo (2.0.6)
126
129
  concurrent-ruby (~> 1.0)
127
130
  unicode-display_width (2.5.0)
128
- webmock (3.19.1)
131
+ webmock (3.23.1)
129
132
  addressable (>= 2.8.0)
130
133
  crack (>= 0.3.2)
131
134
  hashdiff (>= 0.4.0, < 2.0.0)
132
- yard (0.9.34)
133
- zeitwerk (2.6.12)
135
+ yard (0.9.36)
136
+ zeitwerk (2.6.16)
134
137
 
135
138
  PLATFORMS
136
139
  x86_64-linux
@@ -1,136 +1,139 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- esse-active_record (0.3.4)
4
+ esse-active_record (0.3.6)
5
5
  activerecord (>= 4.2, < 8)
6
6
  esse (>= 0.3.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (6.1.7.6)
12
- activesupport (= 6.1.7.6)
13
- activerecord (6.1.7.6)
14
- activemodel (= 6.1.7.6)
15
- activesupport (= 6.1.7.6)
16
- activesupport (6.1.7.6)
11
+ activemodel (6.1.7.8)
12
+ activesupport (= 6.1.7.8)
13
+ activerecord (6.1.7.8)
14
+ activemodel (= 6.1.7.8)
15
+ activesupport (= 6.1.7.8)
16
+ activesupport (6.1.7.8)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 1.6, < 2)
19
19
  minitest (>= 5.1)
20
20
  tzinfo (~> 2.0)
21
21
  zeitwerk (~> 2.3)
22
- addressable (2.8.6)
23
- public_suffix (>= 2.0.2, < 6.0)
22
+ addressable (2.8.7)
23
+ public_suffix (>= 2.0.2, < 7.0)
24
24
  ast (2.4.2)
25
25
  awesome_print (1.9.2)
26
+ base64 (0.2.0)
27
+ bigdecimal (3.1.8)
26
28
  coderay (1.1.3)
27
- concurrent-ruby (1.2.3)
28
- crack (0.4.5)
29
+ concurrent-ruby (1.3.3)
30
+ crack (1.0.0)
31
+ bigdecimal
29
32
  rexml
30
- diff-lcs (1.5.0)
33
+ diff-lcs (1.5.1)
31
34
  dotenv (2.8.1)
32
- elasticsearch (7.17.10)
33
- elasticsearch-api (= 7.17.10)
34
- elasticsearch-transport (= 7.17.10)
35
- elasticsearch-api (7.17.10)
35
+ elasticsearch (7.17.11)
36
+ elasticsearch-api (= 7.17.11)
37
+ elasticsearch-transport (= 7.17.11)
38
+ elasticsearch-api (7.17.11)
36
39
  multi_json
37
- elasticsearch-transport (7.17.10)
40
+ elasticsearch-transport (7.17.11)
41
+ base64
38
42
  faraday (>= 1, < 3)
39
43
  multi_json
40
- esse (0.3.0)
44
+ esse (0.3.4)
41
45
  multi_json
42
46
  thor (>= 0.19)
43
47
  esse-rspec (0.0.6)
44
48
  esse (>= 0.2.4)
45
49
  rspec (>= 3)
46
- faraday (2.0.0)
50
+ faraday (2.8.1)
51
+ base64
52
+ faraday-net_http (>= 2.0, < 3.1)
47
53
  ruby2_keywords (>= 0.0.4)
54
+ faraday-net_http (3.0.2)
48
55
  hashdiff (1.1.0)
49
- i18n (1.14.1)
56
+ i18n (1.14.5)
50
57
  concurrent-ruby (~> 1.0)
51
- json (2.7.1)
58
+ json (2.7.2)
52
59
  language_server-protocol (3.17.0.3)
53
60
  lint_roller (1.1.0)
54
- method_source (1.0.0)
61
+ method_source (1.1.0)
55
62
  mini_portile2 (2.8.7)
56
- minitest (5.21.2)
63
+ minitest (5.24.1)
57
64
  multi_json (1.15.0)
58
- parallel (1.24.0)
59
- parser (3.3.0.5)
65
+ parallel (1.25.1)
66
+ parser (3.3.4.0)
60
67
  ast (~> 2.4.1)
61
68
  racc
62
69
  pry (0.14.2)
63
70
  coderay (~> 1.1)
64
71
  method_source (~> 1.0)
65
- public_suffix (5.0.4)
66
- racc (1.7.3)
72
+ public_suffix (5.1.1)
73
+ racc (1.8.0)
67
74
  rainbow (3.1.1)
68
- rake (13.1.0)
69
- regexp_parser (2.9.0)
70
- rexml (3.2.6)
71
- rspec (3.12.0)
72
- rspec-core (~> 3.12.0)
73
- rspec-expectations (~> 3.12.0)
74
- rspec-mocks (~> 3.12.0)
75
- rspec-core (3.12.2)
76
- rspec-support (~> 3.12.0)
77
- rspec-expectations (3.12.3)
75
+ rake (13.2.1)
76
+ regexp_parser (2.9.2)
77
+ rexml (3.3.2)
78
+ strscan
79
+ rspec (3.13.0)
80
+ rspec-core (~> 3.13.0)
81
+ rspec-expectations (~> 3.13.0)
82
+ rspec-mocks (~> 3.13.0)
83
+ rspec-core (3.13.0)
84
+ rspec-support (~> 3.13.0)
85
+ rspec-expectations (3.13.1)
78
86
  diff-lcs (>= 1.2.0, < 2.0)
79
- rspec-support (~> 3.12.0)
80
- rspec-mocks (3.12.6)
87
+ rspec-support (~> 3.13.0)
88
+ rspec-mocks (3.13.1)
81
89
  diff-lcs (>= 1.2.0, < 2.0)
82
- rspec-support (~> 3.12.0)
83
- rspec-support (3.12.1)
84
- rubocop (1.59.0)
90
+ rspec-support (~> 3.13.0)
91
+ rspec-support (3.13.1)
92
+ rubocop (1.64.1)
85
93
  json (~> 2.3)
86
94
  language_server-protocol (>= 3.17.0)
87
95
  parallel (~> 1.10)
88
- parser (>= 3.2.2.4)
96
+ parser (>= 3.3.0.2)
89
97
  rainbow (>= 2.2.2, < 4.0)
90
98
  regexp_parser (>= 1.8, < 3.0)
91
99
  rexml (>= 3.2.5, < 4.0)
92
- rubocop-ast (>= 1.30.0, < 2.0)
100
+ rubocop-ast (>= 1.31.1, < 2.0)
93
101
  ruby-progressbar (~> 1.7)
94
102
  unicode-display_width (>= 2.4.0, < 3.0)
95
- rubocop-ast (1.30.0)
96
- parser (>= 3.2.1.0)
97
- rubocop-capybara (2.20.0)
98
- rubocop (~> 1.41)
99
- rubocop-factory_bot (2.25.1)
100
- rubocop (~> 1.41)
101
- rubocop-performance (1.20.2)
103
+ rubocop-ast (1.31.3)
104
+ parser (>= 3.3.1.0)
105
+ rubocop-performance (1.21.1)
102
106
  rubocop (>= 1.48.1, < 2.0)
103
- rubocop-ast (>= 1.30.0, < 2.0)
104
- rubocop-rspec (2.26.1)
105
- rubocop (~> 1.40)
106
- rubocop-capybara (~> 2.17)
107
- rubocop-factory_bot (~> 2.22)
107
+ rubocop-ast (>= 1.31.1, < 2.0)
108
+ rubocop-rspec (3.0.3)
109
+ rubocop (~> 1.61)
108
110
  ruby-progressbar (1.13.0)
109
111
  ruby2_keywords (0.0.5)
110
112
  sqlite3 (1.7.3)
111
113
  mini_portile2 (~> 2.8.0)
112
- standard (1.33.0)
114
+ standard (1.37.0)
113
115
  language_server-protocol (~> 3.17.0.2)
114
116
  lint_roller (~> 1.0)
115
- rubocop (~> 1.59.0)
117
+ rubocop (~> 1.64.0)
116
118
  standard-custom (~> 1.0.0)
117
- standard-performance (~> 1.3)
119
+ standard-performance (~> 1.4)
118
120
  standard-custom (1.0.2)
119
121
  lint_roller (~> 1.0)
120
122
  rubocop (~> 1.50)
121
- standard-performance (1.3.1)
123
+ standard-performance (1.4.0)
122
124
  lint_roller (~> 1.1)
123
- rubocop-performance (~> 1.20.2)
124
- thor (1.3.0)
125
+ rubocop-performance (~> 1.21.0)
126
+ strscan (3.1.0)
127
+ thor (1.3.1)
125
128
  tzinfo (2.0.6)
126
129
  concurrent-ruby (~> 1.0)
127
130
  unicode-display_width (2.5.0)
128
- webmock (3.19.1)
131
+ webmock (3.23.1)
129
132
  addressable (>= 2.8.0)
130
133
  crack (>= 0.3.2)
131
134
  hashdiff (>= 0.4.0, < 2.0.0)
132
- yard (0.9.34)
133
- zeitwerk (2.6.12)
135
+ yard (0.9.36)
136
+ zeitwerk (2.6.16)
134
137
 
135
138
  PLATFORMS
136
139
  x86_64-linux
@@ -1,20 +1,20 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- esse-active_record (0.3.4)
4
+ esse-active_record (0.3.6)
5
5
  activerecord (>= 4.2, < 8)
6
6
  esse (>= 0.3.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (7.1.3)
12
- activesupport (= 7.1.3)
13
- activerecord (7.1.3)
14
- activemodel (= 7.1.3)
15
- activesupport (= 7.1.3)
11
+ activemodel (7.1.3.4)
12
+ activesupport (= 7.1.3.4)
13
+ activerecord (7.1.3.4)
14
+ activemodel (= 7.1.3.4)
15
+ activesupport (= 7.1.3.4)
16
16
  timeout (>= 0.4.0)
17
- activesupport (7.1.3)
17
+ activesupport (7.1.3.4)
18
18
  base64
19
19
  bigdecimal
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -24,124 +24,124 @@ GEM
24
24
  minitest (>= 5.1)
25
25
  mutex_m
26
26
  tzinfo (~> 2.0)
27
- addressable (2.8.6)
28
- public_suffix (>= 2.0.2, < 6.0)
27
+ addressable (2.8.7)
28
+ public_suffix (>= 2.0.2, < 7.0)
29
29
  ast (2.4.2)
30
30
  awesome_print (1.9.2)
31
31
  base64 (0.2.0)
32
- bigdecimal (3.1.6)
32
+ bigdecimal (3.1.8)
33
33
  coderay (1.1.3)
34
- concurrent-ruby (1.2.3)
34
+ concurrent-ruby (1.3.3)
35
35
  connection_pool (2.4.1)
36
- crack (0.4.5)
36
+ crack (1.0.0)
37
+ bigdecimal
37
38
  rexml
38
- diff-lcs (1.5.0)
39
+ diff-lcs (1.5.1)
39
40
  dotenv (2.8.1)
40
- drb (2.2.0)
41
- ruby2_keywords
42
- elasticsearch (7.17.10)
43
- elasticsearch-api (= 7.17.10)
44
- elasticsearch-transport (= 7.17.10)
45
- elasticsearch-api (7.17.10)
41
+ drb (2.2.1)
42
+ elasticsearch (7.17.11)
43
+ elasticsearch-api (= 7.17.11)
44
+ elasticsearch-transport (= 7.17.11)
45
+ elasticsearch-api (7.17.11)
46
46
  multi_json
47
- elasticsearch-transport (7.17.10)
47
+ elasticsearch-transport (7.17.11)
48
+ base64
48
49
  faraday (>= 1, < 3)
49
50
  multi_json
50
- esse (0.3.0)
51
+ esse (0.3.4)
51
52
  multi_json
52
53
  thor (>= 0.19)
53
54
  esse-rspec (0.0.6)
54
55
  esse (>= 0.2.4)
55
56
  rspec (>= 3)
56
- faraday (2.0.0)
57
+ faraday (2.8.1)
58
+ base64
59
+ faraday-net_http (>= 2.0, < 3.1)
57
60
  ruby2_keywords (>= 0.0.4)
61
+ faraday-net_http (3.0.2)
58
62
  hashdiff (1.1.0)
59
- i18n (1.14.1)
63
+ i18n (1.14.5)
60
64
  concurrent-ruby (~> 1.0)
61
- json (2.7.1)
65
+ json (2.7.2)
62
66
  language_server-protocol (3.17.0.3)
63
67
  lint_roller (1.1.0)
64
- method_source (1.0.0)
68
+ method_source (1.1.0)
65
69
  mini_portile2 (2.8.7)
66
- minitest (5.21.2)
70
+ minitest (5.24.1)
67
71
  multi_json (1.15.0)
68
72
  mutex_m (0.2.0)
69
- parallel (1.24.0)
70
- parser (3.3.0.5)
73
+ parallel (1.25.1)
74
+ parser (3.3.4.0)
71
75
  ast (~> 2.4.1)
72
76
  racc
73
77
  pry (0.14.2)
74
78
  coderay (~> 1.1)
75
79
  method_source (~> 1.0)
76
- public_suffix (5.0.4)
77
- racc (1.7.3)
80
+ public_suffix (5.1.1)
81
+ racc (1.8.0)
78
82
  rainbow (3.1.1)
79
- rake (13.1.0)
80
- regexp_parser (2.9.0)
81
- rexml (3.2.6)
82
- rspec (3.12.0)
83
- rspec-core (~> 3.12.0)
84
- rspec-expectations (~> 3.12.0)
85
- rspec-mocks (~> 3.12.0)
86
- rspec-core (3.12.2)
87
- rspec-support (~> 3.12.0)
88
- rspec-expectations (3.12.3)
83
+ rake (13.2.1)
84
+ regexp_parser (2.9.2)
85
+ rexml (3.3.2)
86
+ strscan
87
+ rspec (3.13.0)
88
+ rspec-core (~> 3.13.0)
89
+ rspec-expectations (~> 3.13.0)
90
+ rspec-mocks (~> 3.13.0)
91
+ rspec-core (3.13.0)
92
+ rspec-support (~> 3.13.0)
93
+ rspec-expectations (3.13.1)
89
94
  diff-lcs (>= 1.2.0, < 2.0)
90
- rspec-support (~> 3.12.0)
91
- rspec-mocks (3.12.6)
95
+ rspec-support (~> 3.13.0)
96
+ rspec-mocks (3.13.1)
92
97
  diff-lcs (>= 1.2.0, < 2.0)
93
- rspec-support (~> 3.12.0)
94
- rspec-support (3.12.1)
95
- rubocop (1.59.0)
98
+ rspec-support (~> 3.13.0)
99
+ rspec-support (3.13.1)
100
+ rubocop (1.64.1)
96
101
  json (~> 2.3)
97
102
  language_server-protocol (>= 3.17.0)
98
103
  parallel (~> 1.10)
99
- parser (>= 3.2.2.4)
104
+ parser (>= 3.3.0.2)
100
105
  rainbow (>= 2.2.2, < 4.0)
101
106
  regexp_parser (>= 1.8, < 3.0)
102
107
  rexml (>= 3.2.5, < 4.0)
103
- rubocop-ast (>= 1.30.0, < 2.0)
108
+ rubocop-ast (>= 1.31.1, < 2.0)
104
109
  ruby-progressbar (~> 1.7)
105
110
  unicode-display_width (>= 2.4.0, < 3.0)
106
- rubocop-ast (1.30.0)
107
- parser (>= 3.2.1.0)
108
- rubocop-capybara (2.20.0)
109
- rubocop (~> 1.41)
110
- rubocop-factory_bot (2.25.1)
111
- rubocop (~> 1.41)
112
- rubocop-performance (1.20.2)
111
+ rubocop-ast (1.31.3)
112
+ parser (>= 3.3.1.0)
113
+ rubocop-performance (1.21.1)
113
114
  rubocop (>= 1.48.1, < 2.0)
114
- rubocop-ast (>= 1.30.0, < 2.0)
115
- rubocop-rspec (2.26.1)
116
- rubocop (~> 1.40)
117
- rubocop-capybara (~> 2.17)
118
- rubocop-factory_bot (~> 2.22)
115
+ rubocop-ast (>= 1.31.1, < 2.0)
116
+ rubocop-rspec (3.0.3)
117
+ rubocop (~> 1.61)
119
118
  ruby-progressbar (1.13.0)
120
119
  ruby2_keywords (0.0.5)
121
120
  sqlite3 (1.7.3)
122
121
  mini_portile2 (~> 2.8.0)
123
- standard (1.33.0)
122
+ standard (1.37.0)
124
123
  language_server-protocol (~> 3.17.0.2)
125
124
  lint_roller (~> 1.0)
126
- rubocop (~> 1.59.0)
125
+ rubocop (~> 1.64.0)
127
126
  standard-custom (~> 1.0.0)
128
- standard-performance (~> 1.3)
127
+ standard-performance (~> 1.4)
129
128
  standard-custom (1.0.2)
130
129
  lint_roller (~> 1.0)
131
130
  rubocop (~> 1.50)
132
- standard-performance (1.3.1)
131
+ standard-performance (1.4.0)
133
132
  lint_roller (~> 1.1)
134
- rubocop-performance (~> 1.20.2)
135
- thor (1.3.0)
133
+ rubocop-performance (~> 1.21.0)
134
+ strscan (3.1.0)
135
+ thor (1.3.1)
136
136
  timeout (0.4.1)
137
137
  tzinfo (2.0.6)
138
138
  concurrent-ruby (~> 1.0)
139
139
  unicode-display_width (2.5.0)
140
- webmock (3.19.1)
140
+ webmock (3.23.1)
141
141
  addressable (>= 2.8.0)
142
142
  crack (>= 0.3.2)
143
143
  hashdiff (>= 0.4.0, < 2.0.0)
144
- yard (0.9.34)
144
+ yard (0.9.36)
145
145
 
146
146
  PLATFORMS
147
147
  x86_64-linux
@@ -6,7 +6,7 @@ module Esse::ActiveRecord
6
6
  def call(model)
7
7
  record = block_result || model
8
8
  document = repo.serialize(record)
9
- repo.index.index(document, **options) if document
9
+ repo.index.index(document, **options) if document && !document.ignore_on_index?
10
10
  true
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Esse::ActiveRecord
6
6
  def call(model)
7
7
  record = block_result || model
8
8
  document = repo.serialize(record)
9
- repo.index.delete(document, **options) if document
9
+ repo.index.delete(document, **options) if document && !document.ignore_on_delete?
10
10
  true
11
11
  rescue Esse::Transport::NotFoundError
12
12
  true
@@ -3,13 +3,6 @@
3
3
  module Esse::ActiveRecord
4
4
  module Callbacks
5
5
  class IndexingOnUpdate < Callback
6
- attr_reader :update_with
7
-
8
- def initialize(with: :index, **kwargs, &block)
9
- @update_with = with
10
- super(**kwargs, &block)
11
- end
12
-
13
6
  def call(model)
14
7
  record = block_result || model
15
8
 
@@ -41,7 +34,9 @@ module Esse::ActiveRecord
41
34
  protected
42
35
 
43
36
  def update_document(document)
44
- if update_with == :update
37
+ return if document.ignore_on_index?
38
+
39
+ if @with == :update || (@with.nil? && repo.lazy_document_attributes.any?)
45
40
  begin
46
41
  repo.index.update(document, **options)
47
42
  rescue Esse::Transport::NotFoundError
@@ -5,8 +5,9 @@ module Esse
5
5
  class Callback
6
6
  attr_reader :repo, :options, :block_result
7
7
 
8
- def initialize(repo:, block_result: nil, **kwargs)
8
+ def initialize(repo:, block_result: nil, with: nil, **kwargs)
9
9
  @repo = repo
10
+ @with = with
10
11
  @options = kwargs
11
12
  @block_result = block_result
12
13
  end
@@ -27,7 +28,7 @@ module Esse
27
28
  raise ArgumentError, 'callback_class must be a subclass of Esse::ActiveRecord::Callback'
28
29
  end
29
30
 
30
- key = :"#{identifier}_on_#{operation}"
31
+ key = [operation, identifier].join('_').to_sym
31
32
 
32
33
  @callbacks = @callbacks ? @callbacks.dup : {}
33
34
  if @callbacks.key?(key)
@@ -42,11 +43,12 @@ module Esse
42
43
  def registered?(identifier, operation)
43
44
  return false unless @callbacks
44
45
 
45
- @callbacks.key?(:"#{identifier}_on_#{operation}")
46
+ key = [operation, identifier].join('_').to_sym
47
+ @callbacks.key?(key)
46
48
  end
47
49
 
48
50
  def fetch!(identifier, operation)
49
- key = :"#{identifier}_on_#{operation}"
51
+ key = [operation, identifier].join('_').to_sym
50
52
  if registered?(identifier, operation)
51
53
  [key, @callbacks[key]]
52
54
  else
@@ -83,6 +83,17 @@ module Esse
83
83
  end
84
84
  end
85
85
 
86
+ def each_batch_ids
87
+ dataset.select(:id).except(:includes, :preload, :eager_load).find_in_batches(**batch_options) do |rows|
88
+ yield(rows.map(&:id))
89
+ end
90
+ end
91
+
92
+ def count
93
+ dataset.except(:includes, :preload, :eager_load, :group, :order, :limit, :offset).count
94
+ end
95
+ alias_method :size, :count
96
+
86
97
  def dataset(**kwargs)
87
98
  query = self.class.base_scope&.call || raise(NotImplementedError, "No scope defined for #{self.class}")
88
99
  query = query.except(:order, :limit, :offset)
@@ -12,7 +12,7 @@ module Esse
12
12
  @esse_callbacks ||= {}.freeze
13
13
  end
14
14
 
15
- def esse_callback(index_repo_name, operation_name, on: %i[create update destroy], **options, &block)
15
+ def esse_callback(index_repo_name, operation_name, on: %i[create update destroy], identifier_suffix: nil, **options, &block)
16
16
  @esse_callbacks = esse_callbacks.dup
17
17
  cb_if = options.delete(:if)
18
18
  cb_unless = options.delete(:unless)
@@ -25,6 +25,9 @@ module Esse
25
25
 
26
26
  Array(on).each do |event|
27
27
  identifier, klass = Esse::ActiveRecord::Callbacks.fetch!(operation_name, event)
28
+ if identifier_suffix
29
+ identifier = :"#{identifier}_#{identifier_suffix}"
30
+ end
28
31
 
29
32
  if @esse_callbacks.dig(index_repo_name, identifier)
30
33
  raise ArgumentError, format('index repository %<name>p already registered %<op>s operation', name: index_repo_name, op: operation_name)
@@ -71,7 +74,7 @@ module Esse
71
74
 
72
75
  def update_lazy_attribute_callback(index_repo_name, attribute_name, on: %i[create update destroy], **options, &block)
73
76
  options[:attribute_name] = attribute_name
74
- esse_callback(index_repo_name, :update_lazy_attribute, on: on, **options, &block)
77
+ esse_callback(index_repo_name, :update_lazy_attribute, identifier_suffix: attribute_name.to_sym, on: on, **options, &block)
75
78
  end
76
79
 
77
80
  # Disable indexing for the block execution on model level
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Esse
4
4
  module ActiveRecord
5
- VERSION = '0.3.4'
5
+ VERSION = '0.3.6'
6
6
  end
7
7
  end
@@ -11,7 +11,7 @@ module Esse
11
11
  # @option options [Symbol] :batch_size The batch size for the collection
12
12
  def collection(*args, **kwargs, &block)
13
13
  unless model_or_relation?(args.first)
14
- return super(*args, **kwargs, &block)
14
+ return super
15
15
  end
16
16
  model_class = args.shift
17
17
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esse-active_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos G. Zimmermann
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-12 00:00:00.000000000 Z
11
+ date: 2024-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: esse