subroutine 4.5.0 → 5.0.0.alpha
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 303c840aa8c1160127aefad35c51f98b6f85d3b24231cb256b6dbebb1b7316a9
|
4
|
+
data.tar.gz: 45e2c676ef66e7fb3282c30c793edf20dcc748a7e263cf9c41d81e0f5e13ce75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21bea30ad507b474915b6b5dcfd5c901f189f35dd484b755e49608879cd259e43b70d7ca6d27121db1b80b89cb000454a16dba5b886eb1c651a2b866910185da
|
7
|
+
data.tar.gz: 570dcacb9c6c09a9879aa012faccea7d8dce18591a5c47b6415b708ca06a04ac6eef9ef8f88da449d439d4abf8702b509021c33e9bb1baf7769fe03304fdfdca
|
@@ -66,6 +66,8 @@ module Subroutine
|
|
66
66
|
if options[:type]&.to_sym == :association
|
67
67
|
config = ::Subroutine::AssociationFields::Configuration.new(field_name, options)
|
68
68
|
|
69
|
+
field_without_association(config.as, config)
|
70
|
+
|
69
71
|
if config.polymorphic?
|
70
72
|
field config.foreign_type_method, config.build_foreign_type_field
|
71
73
|
else
|
@@ -77,8 +79,6 @@ module Subroutine
|
|
77
79
|
end
|
78
80
|
|
79
81
|
field config.foreign_key_method, config.build_foreign_key_field
|
80
|
-
|
81
|
-
field_without_association(config.as, config)
|
82
82
|
else
|
83
83
|
field_without_association(field_name, options)
|
84
84
|
end
|
data/lib/subroutine/fields.rb
CHANGED
@@ -7,6 +7,8 @@ require "subroutine/fields/mass_assignment_error"
|
|
7
7
|
module Subroutine
|
8
8
|
module Fields
|
9
9
|
|
10
|
+
DuplicateFieldError = Class.new(StandardError)
|
11
|
+
|
10
12
|
extend ActiveSupport::Concern
|
11
13
|
|
12
14
|
def self.allowed_input_classes
|
@@ -30,6 +32,11 @@ module Subroutine
|
|
30
32
|
module ClassMethods
|
31
33
|
|
32
34
|
def field(field_name, options = {})
|
35
|
+
|
36
|
+
if field_configurations.key?(field_name.to_sym) && !options[:allow_override]
|
37
|
+
raise DuplicateFieldError, "#{field_name} is already defined on #{self}. Add `allow_override: true` to reconfigure the field."
|
38
|
+
end
|
39
|
+
|
33
40
|
config = ::Subroutine::Fields::Configuration.from(field_name, options)
|
34
41
|
config.validate!
|
35
42
|
|
data/lib/subroutine/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subroutine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Nelson
|
8
|
+
autorequire:
|
8
9
|
bindir: bin
|
9
10
|
cert_chain: []
|
10
|
-
date:
|
11
|
+
date: 2025-06-04 00:00:00.000000000 Z
|
11
12
|
dependencies:
|
12
13
|
- !ruby/object:Gem::Dependency
|
13
14
|
name: activemodel
|
@@ -225,6 +226,7 @@ licenses:
|
|
225
226
|
metadata:
|
226
227
|
allowed_push_host: https://rubygems.org
|
227
228
|
rubygems_mfa_required: 'true'
|
229
|
+
post_install_message:
|
228
230
|
rdoc_options: []
|
229
231
|
require_paths:
|
230
232
|
- lib
|
@@ -239,7 +241,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
241
|
- !ruby/object:Gem::Version
|
240
242
|
version: '0'
|
241
243
|
requirements: []
|
242
|
-
rubygems_version: 3.
|
244
|
+
rubygems_version: 3.5.22
|
245
|
+
signing_key:
|
243
246
|
specification_version: 4
|
244
247
|
summary: Feature-driven operation objects.
|
245
248
|
test_files: []
|