rails_ops 1.7.5 → 1.7.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: '09afcf92fcfe05c19396772f107cca504cbd76186308c5a1c47ff19251bba729'
4
- data.tar.gz: ba78cd40f1de1ecbc3e49228d4e1b3234aa28b8799eeb7cc33e21efdf7eea180
3
+ metadata.gz: 3cbedc7c32b0c2426655e10cc0976a0156d7558fc7ddf60e12a04a554ebd3955
4
+ data.tar.gz: 06e926c30fb1b8228eb6f818910392ef9d0509fd610e16effca49f0f49d8389a
5
5
  SHA512:
6
- metadata.gz: 5c025ebad330089c7dacdd2b624a554c8c57e912692b9e51e3eeb533e3f18d66f4cf04bbd31c33e5976821339a4df429e318e0c9dff16b39bd0e047cdf121b66
7
- data.tar.gz: ef79e94918d4f81ea11b1c304340a23bbd2f86ac8f450b0ae4cd98fa0acb26c08d15376b0f2db5674389d9aa07966bdbdf4f9b20b4c341e95f36878a1b095f75
6
+ metadata.gz: cdc2260ce72809585f7bd5b68311d84e9342afdc27dee51f5fb402e9431285a166d9610bc5479f6b5e0837f1c7ec1638da58002e28a912ab4e89447b81da668c
7
+ data.tar.gz: 580e14d0f3aa76014e806e64efbb575f9f8287dcbf0460fe4d3ae3baed162e7b0d1e444d3d2e21fc4c88dad1cc169cb8cff5bb7c1393428201255a35e49637fd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.6 (2026-02-24)
4
+
5
+ * Add `find_model_relation` hook to `RailsOps::Operation::Model::Load`.
6
+ This protected method can be overridden in subclasses to customize the
7
+ relation used for looking up the model, e.g. to apply scopes or use a
8
+ different base query. Since `Update` and `Destroy` inherit from `Load`,
9
+ the hook is available in all model operations that load a record. The
10
+ default implementation returns `self.class.model`, preserving existing
11
+ behavior.
12
+
3
13
  ## 1.7.5 (2026-02-18)
4
14
 
5
15
  * Add GitHub URL as homepage in gemspec.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_ops (1.7.5)
4
+ rails_ops (1.7.6)
5
5
  active_type (>= 1.3.0)
6
6
  minitest
7
7
  rails (> 4)
@@ -11,35 +11,35 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actioncable (7.1.3.4)
15
- actionpack (= 7.1.3.4)
16
- activesupport (= 7.1.3.4)
14
+ actioncable (7.1.5.2)
15
+ actionpack (= 7.1.5.2)
16
+ activesupport (= 7.1.5.2)
17
17
  nio4r (~> 2.0)
18
18
  websocket-driver (>= 0.6.1)
19
19
  zeitwerk (~> 2.6)
20
- actionmailbox (7.1.3.4)
21
- actionpack (= 7.1.3.4)
22
- activejob (= 7.1.3.4)
23
- activerecord (= 7.1.3.4)
24
- activestorage (= 7.1.3.4)
25
- activesupport (= 7.1.3.4)
20
+ actionmailbox (7.1.5.2)
21
+ actionpack (= 7.1.5.2)
22
+ activejob (= 7.1.5.2)
23
+ activerecord (= 7.1.5.2)
24
+ activestorage (= 7.1.5.2)
25
+ activesupport (= 7.1.5.2)
26
26
  mail (>= 2.7.1)
27
27
  net-imap
28
28
  net-pop
29
29
  net-smtp
30
- actionmailer (7.1.3.4)
31
- actionpack (= 7.1.3.4)
32
- actionview (= 7.1.3.4)
33
- activejob (= 7.1.3.4)
34
- activesupport (= 7.1.3.4)
30
+ actionmailer (7.1.5.2)
31
+ actionpack (= 7.1.5.2)
32
+ actionview (= 7.1.5.2)
33
+ activejob (= 7.1.5.2)
34
+ activesupport (= 7.1.5.2)
35
35
  mail (~> 2.5, >= 2.5.4)
36
36
  net-imap
37
37
  net-pop
38
38
  net-smtp
39
39
  rails-dom-testing (~> 2.2)
40
- actionpack (7.1.3.4)
41
- actionview (= 7.1.3.4)
42
- activesupport (= 7.1.3.4)
40
+ actionpack (7.1.5.2)
41
+ actionview (= 7.1.5.2)
42
+ activesupport (= 7.1.5.2)
43
43
  nokogiri (>= 1.8.5)
44
44
  racc
45
45
  rack (>= 2.2.4)
@@ -47,66 +47,70 @@ GEM
47
47
  rack-test (>= 0.6.3)
48
48
  rails-dom-testing (~> 2.2)
49
49
  rails-html-sanitizer (~> 1.6)
50
- actiontext (7.1.3.4)
51
- actionpack (= 7.1.3.4)
52
- activerecord (= 7.1.3.4)
53
- activestorage (= 7.1.3.4)
54
- activesupport (= 7.1.3.4)
50
+ actiontext (7.1.5.2)
51
+ actionpack (= 7.1.5.2)
52
+ activerecord (= 7.1.5.2)
53
+ activestorage (= 7.1.5.2)
54
+ activesupport (= 7.1.5.2)
55
55
  globalid (>= 0.6.0)
56
56
  nokogiri (>= 1.8.5)
57
- actionview (7.1.3.4)
58
- activesupport (= 7.1.3.4)
57
+ actionview (7.1.5.2)
58
+ activesupport (= 7.1.5.2)
59
59
  builder (~> 3.1)
60
60
  erubi (~> 1.11)
61
61
  rails-dom-testing (~> 2.2)
62
62
  rails-html-sanitizer (~> 1.6)
63
63
  active_type (2.5.0)
64
64
  activerecord (>= 3.2)
65
- activejob (7.1.3.4)
66
- activesupport (= 7.1.3.4)
65
+ activejob (7.1.5.2)
66
+ activesupport (= 7.1.5.2)
67
67
  globalid (>= 0.3.6)
68
- activemodel (7.1.3.4)
69
- activesupport (= 7.1.3.4)
70
- activerecord (7.1.3.4)
71
- activemodel (= 7.1.3.4)
72
- activesupport (= 7.1.3.4)
68
+ activemodel (7.1.5.2)
69
+ activesupport (= 7.1.5.2)
70
+ activerecord (7.1.5.2)
71
+ activemodel (= 7.1.5.2)
72
+ activesupport (= 7.1.5.2)
73
73
  timeout (>= 0.4.0)
74
- activestorage (7.1.3.4)
75
- actionpack (= 7.1.3.4)
76
- activejob (= 7.1.3.4)
77
- activerecord (= 7.1.3.4)
78
- activesupport (= 7.1.3.4)
74
+ activestorage (7.1.5.2)
75
+ actionpack (= 7.1.5.2)
76
+ activejob (= 7.1.5.2)
77
+ activerecord (= 7.1.5.2)
78
+ activesupport (= 7.1.5.2)
79
79
  marcel (~> 1.0)
80
- activesupport (7.1.3.4)
80
+ activesupport (7.1.5.2)
81
81
  base64
82
+ benchmark (>= 0.3)
82
83
  bigdecimal
83
84
  concurrent-ruby (~> 1.0, >= 1.0.2)
84
85
  connection_pool (>= 2.2.5)
85
86
  drb
86
87
  i18n (>= 1.6, < 2)
88
+ logger (>= 1.4.2)
87
89
  minitest (>= 5.1)
88
90
  mutex_m
91
+ securerandom (>= 0.3)
89
92
  tzinfo (~> 2.0)
90
93
  appraisal (2.4.1)
91
94
  bundler
92
95
  rake
93
96
  thor (>= 0.14.0)
94
97
  ast (2.4.2)
95
- base64 (0.2.0)
96
- bigdecimal (3.1.8)
98
+ base64 (0.3.0)
99
+ benchmark (0.5.0)
100
+ bigdecimal (4.0.1)
97
101
  builder (3.2.4)
98
102
  cancancan (3.5.0)
99
103
  coderay (1.1.3)
100
- concurrent-ruby (1.3.1)
101
- connection_pool (2.4.1)
104
+ concurrent-ruby (1.3.6)
105
+ connection_pool (3.0.2)
102
106
  crass (1.0.6)
103
- date (3.3.4)
107
+ date (3.5.1)
104
108
  docile (1.4.0)
105
- drb (2.2.1)
109
+ drb (2.2.3)
106
110
  erubi (1.12.0)
107
111
  globalid (1.2.1)
108
112
  activesupport (>= 6.1)
109
- i18n (1.14.5)
113
+ i18n (1.14.8)
110
114
  concurrent-ruby (~> 1.0)
111
115
  io-console (0.7.2)
112
116
  irb (1.11.2)
@@ -114,6 +118,7 @@ GEM
114
118
  reline (>= 0.4.2)
115
119
  json (2.9.1)
116
120
  language_server-protocol (3.17.0.3)
121
+ logger (1.7.0)
117
122
  loofah (2.22.0)
118
123
  crass (~> 1.0.2)
119
124
  nokogiri (>= 1.12.0)
@@ -126,8 +131,8 @@ GEM
126
131
  method_source (1.0.0)
127
132
  mini_mime (1.1.5)
128
133
  minitest (5.27.0)
129
- mutex_m (0.2.0)
130
- net-imap (0.4.10)
134
+ mutex_m (0.3.0)
135
+ net-imap (0.4.20)
131
136
  date
132
137
  net-protocol
133
138
  net-pop (0.1.2)
@@ -137,11 +142,11 @@ GEM
137
142
  net-smtp (0.4.0.1)
138
143
  net-protocol
139
144
  nio4r (2.7.0)
140
- nokogiri (1.16.5-arm64-darwin)
145
+ nokogiri (1.19.1-arm64-darwin)
141
146
  racc (~> 1.4)
142
- nokogiri (1.16.5-x86_64-darwin)
147
+ nokogiri (1.19.1-x86_64-darwin)
143
148
  racc (~> 1.4)
144
- nokogiri (1.16.5-x86_64-linux)
149
+ nokogiri (1.19.1-x86_64-linux-gnu)
145
150
  racc (~> 1.4)
146
151
  parallel (1.26.3)
147
152
  parser (3.3.7.0)
@@ -152,29 +157,30 @@ GEM
152
157
  method_source (~> 1.0)
153
158
  psych (5.1.2)
154
159
  stringio
155
- racc (1.8.0)
156
- rack (3.0.11)
157
- rack-session (2.0.0)
160
+ racc (1.8.1)
161
+ rack (3.2.5)
162
+ rack-session (2.1.1)
163
+ base64 (>= 0.1.0)
158
164
  rack (>= 3.0.0)
159
165
  rack-test (2.1.0)
160
166
  rack (>= 1.3)
161
167
  rackup (2.1.0)
162
168
  rack (>= 3)
163
169
  webrick (~> 1.8)
164
- rails (7.1.3.4)
165
- actioncable (= 7.1.3.4)
166
- actionmailbox (= 7.1.3.4)
167
- actionmailer (= 7.1.3.4)
168
- actionpack (= 7.1.3.4)
169
- actiontext (= 7.1.3.4)
170
- actionview (= 7.1.3.4)
171
- activejob (= 7.1.3.4)
172
- activemodel (= 7.1.3.4)
173
- activerecord (= 7.1.3.4)
174
- activestorage (= 7.1.3.4)
175
- activesupport (= 7.1.3.4)
170
+ rails (7.1.5.2)
171
+ actioncable (= 7.1.5.2)
172
+ actionmailbox (= 7.1.5.2)
173
+ actionmailer (= 7.1.5.2)
174
+ actionpack (= 7.1.5.2)
175
+ actiontext (= 7.1.5.2)
176
+ actionview (= 7.1.5.2)
177
+ activejob (= 7.1.5.2)
178
+ activemodel (= 7.1.5.2)
179
+ activerecord (= 7.1.5.2)
180
+ activestorage (= 7.1.5.2)
181
+ activesupport (= 7.1.5.2)
176
182
  bundler (>= 1.15.0)
177
- railties (= 7.1.3.4)
183
+ railties (= 7.1.5.2)
178
184
  rails-dom-testing (2.2.0)
179
185
  activesupport (>= 5.0.0)
180
186
  minitest
@@ -182,9 +188,9 @@ GEM
182
188
  rails-html-sanitizer (1.6.0)
183
189
  loofah (~> 2.21)
184
190
  nokogiri (~> 1.14)
185
- railties (7.1.3.4)
186
- actionpack (= 7.1.3.4)
187
- activesupport (= 7.1.3.4)
191
+ railties (7.1.5.2)
192
+ actionpack (= 7.1.5.2)
193
+ activesupport (= 7.1.5.2)
188
194
  irb
189
195
  rackup (>= 1.0.0)
190
196
  rake (>= 12.2)
@@ -216,6 +222,7 @@ GEM
216
222
  schemacop (3.0.22)
217
223
  activesupport (>= 4.0)
218
224
  ruby2_keywords (= 0.0.4)
225
+ securerandom (0.4.1)
219
226
  simplecov (0.22.0)
220
227
  docile (~> 1.1)
221
228
  simplecov-html (~> 0.11)
@@ -234,13 +241,13 @@ GEM
234
241
  sqlite3 (1.6.2-x86_64-linux)
235
242
  stringio (3.1.0)
236
243
  thor (1.3.1)
237
- timeout (0.4.1)
244
+ timeout (0.6.0)
238
245
  tzinfo (2.0.6)
239
246
  concurrent-ruby (~> 1.0)
240
247
  unicode-display_width (3.1.4)
241
248
  unicode-emoji (~> 4.0, >= 4.0.4)
242
249
  unicode-emoji (4.0.4)
243
- webrick (1.8.1)
250
+ webrick (1.8.2)
244
251
  websocket-driver (0.7.6)
245
252
  websocket-extensions (>= 0.1.0)
246
253
  websocket-extensions (0.1.5)
data/README.md CHANGED
@@ -1167,6 +1167,34 @@ class Operations::User::Load < RailsOps::Operation::Model::Load
1167
1167
  end
1168
1168
  ```
1169
1169
 
1170
+ #### Customizing the Lookup Relation
1171
+
1172
+ By default, `Load` operations look up the model using the relation returned
1173
+ by `self.class.model` (i.e. the model class itself). If you need to use a
1174
+ custom relation — for example to apply a scope, join additional tables, or
1175
+ restrict visibility — you can override the `protected` method
1176
+ `find_model_relation`.
1177
+
1178
+ Since `Update` and `Destroy` operations inherit from `Load`, this hook is
1179
+ available in all of them. For example, you can scope an `Update` operation
1180
+ so that it only finds records belonging to the current user's organization:
1181
+
1182
+ ```ruby
1183
+ class Operations::User::Update < RailsOps::Operation::Model::Update
1184
+ model User
1185
+
1186
+ protected
1187
+
1188
+ def find_model_relation
1189
+ User.where(organization: context.user.organization)
1190
+ end
1191
+ end
1192
+ ```
1193
+
1194
+ The returned object must be an ActiveRecord relation (or the model class
1195
+ itself, which acts as one). Locking and eager loading via `model_includes`
1196
+ are applied on top of whatever relation this method returns.
1197
+
1170
1198
  #### Locking
1171
1199
 
1172
1200
  In most cases when you load a model, you might want to lock the corresponding
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ task :gemspec do
15
15
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
16
  spec.require_paths = ['lib']
17
17
  spec.licenses = ['MIT']
18
- spec.homepage = 'https://github.com/sitrox/rails_ops'
18
+ spec.homepage = 'https://github.com/sitrox/rails_ops'
19
19
 
20
20
  spec.add_dependency 'active_type', '>= 1.3.0'
21
21
  spec.add_dependency 'minitest'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.5
1
+ 1.7.6
@@ -79,8 +79,8 @@ class RailsOps::Operation::Model::Load < RailsOps::Operation::Model
79
79
  fail "Param #{model_id_field.inspect} must be given."
80
80
  end
81
81
 
82
- # Get model class
83
- relation = self.class.model
82
+ # Obtain relation
83
+ relation = find_model_relation
84
84
 
85
85
  # Express intention to lock if required
86
86
  relation = lock_relation(relation)
@@ -110,6 +110,27 @@ class RailsOps::Operation::Model::Load < RailsOps::Operation::Model
110
110
  params[model_id_field]
111
111
  end
112
112
 
113
+ protected
114
+
115
+ # Returns the base relation used by {#find_model} to look up the model
116
+ # record. Override this method in subclasses to customize the lookup
117
+ # relation, e.g. to apply scopes or restrict visibility.
118
+ #
119
+ # The returned object must respond to `find_by!` (i.e. be an
120
+ # `ActiveRecord::Relation` or the model class itself). Locking and
121
+ # eager loading via {.model_includes} are applied on top of this
122
+ # relation.
123
+ #
124
+ # @return [ActiveRecord::Relation] the relation to query against
125
+ #
126
+ # @example Scoping to the current user's organization
127
+ # def find_model_relation
128
+ # User.where(organization: context.user.organization)
129
+ # end
130
+ def find_model_relation
131
+ self.class.model
132
+ end
133
+
113
134
  private
114
135
 
115
136
  def lock_relation(relation)
data/rails_ops.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: rails_ops 1.7.5 ruby lib
2
+ # stub: rails_ops 1.7.6 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "rails_ops".freeze
6
- s.version = "1.7.5"
6
+ s.version = "1.7.6"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Sitrox".freeze]
11
- s.date = "2026-02-18"
11
+ s.date = "2026-02-24"
12
12
  s.files = [".github/workflows/rubocop.yml".freeze, ".github/workflows/ruby.yml".freeze, ".gitignore".freeze, ".releaser_config".freeze, ".rubocop.yml".freeze, "Appraisals".freeze, "CHANGELOG.md".freeze, "CLAUDE.md".freeze, "Gemfile".freeze, "Gemfile.lock".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "gemfiles/rails_6.0.gemfile".freeze, "gemfiles/rails_6.1.gemfile".freeze, "gemfiles/rails_7.0.gemfile".freeze, "gemfiles/rails_7.1.gemfile".freeze, "gemfiles/rails_7.2.gemfile".freeze, "gemfiles/rails_8.0.gemfile".freeze, "lib/generators/operation/USAGE".freeze, "lib/generators/operation/operation_generator.rb".freeze, "lib/generators/operation/templates/controller.erb".freeze, "lib/generators/operation/templates/controller_wrapper.erb".freeze, "lib/generators/operation/templates/create.erb".freeze, "lib/generators/operation/templates/destroy.erb".freeze, "lib/generators/operation/templates/load.erb".freeze, "lib/generators/operation/templates/update.erb".freeze, "lib/generators/operation/templates/view.erb".freeze, "lib/rails_ops.rb".freeze, "lib/rails_ops/authorization_backend/abstract.rb".freeze, "lib/rails_ops/authorization_backend/can_can_can.rb".freeze, "lib/rails_ops/configuration.rb".freeze, "lib/rails_ops/context.rb".freeze, "lib/rails_ops/controller_mixin.rb".freeze, "lib/rails_ops/exceptions.rb".freeze, "lib/rails_ops/hooked_job.rb".freeze, "lib/rails_ops/hookup.rb".freeze, "lib/rails_ops/hookup/dsl.rb".freeze, "lib/rails_ops/hookup/dsl_validator.rb".freeze, "lib/rails_ops/hookup/hook.rb".freeze, "lib/rails_ops/log_subscriber.rb".freeze, "lib/rails_ops/mixins.rb".freeze, "lib/rails_ops/mixins/authorization.rb".freeze, "lib/rails_ops/mixins/log_settings.rb".freeze, "lib/rails_ops/mixins/model.rb".freeze, "lib/rails_ops/mixins/model/authorization.rb".freeze, "lib/rails_ops/mixins/model/nesting.rb".freeze, "lib/rails_ops/mixins/param_authorization.rb".freeze, "lib/rails_ops/mixins/policies.rb".freeze, "lib/rails_ops/mixins/require_context.rb".freeze, "lib/rails_ops/mixins/routes.rb".freeze, "lib/rails_ops/mixins/schema_validation.rb".freeze, "lib/rails_ops/mixins/sub_ops.rb".freeze, "lib/rails_ops/model_mixins.rb".freeze, "lib/rails_ops/model_mixins/ar_extension.rb".freeze, "lib/rails_ops/model_mixins/marshalling.rb".freeze, "lib/rails_ops/model_mixins/parent_op.rb".freeze, "lib/rails_ops/model_mixins/sti_fixes.rb".freeze, "lib/rails_ops/model_mixins/virtual_attributes.rb".freeze, "lib/rails_ops/model_mixins/virtual_attributes/virtual_column_wrapper.rb".freeze, "lib/rails_ops/model_mixins/virtual_has_one.rb".freeze, "lib/rails_ops/model_mixins/virtual_model_name.rb".freeze, "lib/rails_ops/operation.rb".freeze, "lib/rails_ops/operation/model.rb".freeze, "lib/rails_ops/operation/model/create.rb".freeze, "lib/rails_ops/operation/model/destroy.rb".freeze, "lib/rails_ops/operation/model/load.rb".freeze, "lib/rails_ops/operation/model/update.rb".freeze, "lib/rails_ops/profiler.rb".freeze, "lib/rails_ops/profiler/node.rb".freeze, "lib/rails_ops/railtie.rb".freeze, "lib/rails_ops/scoped_env.rb".freeze, "lib/rails_ops/virtual_model.rb".freeze, "rails_ops.gemspec".freeze, "test/db/models.rb".freeze, "test/db/schema.rb".freeze, "test/dummy/Rakefile".freeze, "test/dummy/app/assets/config/manifest.js".freeze, "test/dummy/app/assets/images/.keep".freeze, "test/dummy/app/assets/javascripts/application.js".freeze, "test/dummy/app/assets/javascripts/cable.js".freeze, "test/dummy/app/assets/javascripts/channels/.keep".freeze, "test/dummy/app/assets/stylesheets/application.css".freeze, "test/dummy/app/channels/application_cable/channel.rb".freeze, "test/dummy/app/channels/application_cable/connection.rb".freeze, "test/dummy/app/controllers/application_controller.rb".freeze, "test/dummy/app/controllers/concerns/.keep".freeze, "test/dummy/app/controllers/group_controller.rb".freeze, "test/dummy/app/helpers/application_helper.rb".freeze, "test/dummy/app/jobs/application_job.rb".freeze, "test/dummy/app/mailers/application_mailer.rb".freeze, "test/dummy/app/models/ability.rb".freeze, "test/dummy/app/models/animal.rb".freeze, "test/dummy/app/models/application_record.rb".freeze, "test/dummy/app/models/bird.rb".freeze, "test/dummy/app/models/cat.rb".freeze, "test/dummy/app/models/computer.rb".freeze, "test/dummy/app/models/concerns/.keep".freeze, "test/dummy/app/models/cpu.rb".freeze, "test/dummy/app/models/dog.rb".freeze, "test/dummy/app/models/flower.rb".freeze, "test/dummy/app/models/group.rb".freeze, "test/dummy/app/models/mainboard.rb".freeze, "test/dummy/app/models/nightingale.rb".freeze, "test/dummy/app/models/phoenix.rb".freeze, "test/dummy/app/models/user.rb".freeze, "test/dummy/app/views/layouts/application.html.erb".freeze, "test/dummy/app/views/layouts/mailer.html.erb".freeze, "test/dummy/app/views/layouts/mailer.text.erb".freeze, "test/dummy/bin/bundle".freeze, "test/dummy/bin/rails".freeze, "test/dummy/bin/rake".freeze, "test/dummy/bin/setup".freeze, "test/dummy/bin/update".freeze, "test/dummy/bin/yarn".freeze, "test/dummy/config.ru".freeze, "test/dummy/config/application.rb".freeze, "test/dummy/config/boot.rb".freeze, "test/dummy/config/cable.yml".freeze, "test/dummy/config/database.yml".freeze, "test/dummy/config/environment.rb".freeze, "test/dummy/config/environments/development.rb".freeze, "test/dummy/config/environments/production.rb".freeze, "test/dummy/config/environments/test.rb".freeze, "test/dummy/config/hookup.rb".freeze, "test/dummy/config/initializers/application_controller_renderer.rb".freeze, "test/dummy/config/initializers/assets.rb".freeze, "test/dummy/config/initializers/backtrace_silencers.rb".freeze, "test/dummy/config/initializers/cookies_serializer.rb".freeze, "test/dummy/config/initializers/filter_parameter_logging.rb".freeze, "test/dummy/config/initializers/inflections.rb".freeze, "test/dummy/config/initializers/mime_types.rb".freeze, "test/dummy/config/initializers/rails_ops.rb".freeze, "test/dummy/config/initializers/wrap_parameters.rb".freeze, "test/dummy/config/locales/en.yml".freeze, "test/dummy/config/puma.rb".freeze, "test/dummy/config/routes.rb".freeze, "test/dummy/config/secrets.yml".freeze, "test/dummy/config/spring.rb".freeze, "test/dummy/db/schema.rb".freeze, "test/dummy/lib/assets/.keep".freeze, "test/dummy/log/.keep".freeze, "test/dummy/package.json".freeze, "test/dummy/public/404.html".freeze, "test/dummy/public/422.html".freeze, "test/dummy/public/500.html".freeze, "test/dummy/public/apple-touch-icon-precomposed.png".freeze, "test/dummy/public/apple-touch-icon.png".freeze, "test/dummy/public/favicon.ico".freeze, "test/dummy/tmp/.keep".freeze, "test/test_helper.rb".freeze, "test/unit/rails_ops/generators/operation_generator_test.rb".freeze, "test/unit/rails_ops/hookup_test.rb".freeze, "test/unit/rails_ops/mixins/controller_test.rb".freeze, "test/unit/rails_ops/mixins/model/deep_nesting_test.rb".freeze, "test/unit/rails_ops/mixins/model/marshalling_test.rb".freeze, "test/unit/rails_ops/mixins/param_authorization_test.rb".freeze, "test/unit/rails_ops/mixins/policies_test.rb".freeze, "test/unit/rails_ops/operation/auth_test.rb".freeze, "test/unit/rails_ops/operation/model/create_test.rb".freeze, "test/unit/rails_ops/operation/model/destroy_test.rb".freeze, "test/unit/rails_ops/operation/model/load_test.rb".freeze, "test/unit/rails_ops/operation/model/sti_test.rb".freeze, "test/unit/rails_ops/operation/model/update_test.rb".freeze, "test/unit/rails_ops/operation/model_test.rb".freeze, "test/unit/rails_ops/operation/update_lazy_auth_test.rb".freeze, "test/unit/rails_ops/operation_test.rb".freeze, "test/unit/rails_ops/profiler_test.rb".freeze]
13
13
  s.homepage = "https://github.com/sitrox/rails_ops".freeze
14
14
  s.licenses = ["MIT".freeze]
@@ -67,4 +67,31 @@ class RailsOps::Operation::Model::LoadTest < ActiveSupport::TestCase
67
67
  end
68
68
  end
69
69
  end
70
+
71
+ def test_find_model_relation_default
72
+ g = Group.create(name: 'default')
73
+ op = BASIC_OP.new(id: g.id)
74
+ assert_equal g, op.model
75
+ end
76
+
77
+ def test_find_model_relation_override
78
+ g1 = Group.create(name: 'visible')
79
+ g2 = Group.create(name: 'hidden')
80
+
81
+ cls = Class.new(RailsOps::Operation::Model::Load) do
82
+ model Group
83
+
84
+ protected
85
+
86
+ def find_model_relation
87
+ Group.where(name: 'visible')
88
+ end
89
+ end
90
+
91
+ assert_equal g1, cls.new(id: g1.id).model
92
+
93
+ assert_raise ActiveRecord::RecordNotFound do
94
+ cls.new(id: g2.id)
95
+ end
96
+ end
70
97
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_ops
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.5
4
+ version: 1.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sitrox
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-02-18 00:00:00.000000000 Z
10
+ date: 2026-02-24 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: active_type