subroutine 1.0.0.rc2 → 1.0.0.rc3
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: 16421773a13ee6b6c415cd21a1d4c5e43e5e161af42e70260343945b56e660de
|
4
|
+
data.tar.gz: 6a8dcec6f523acef96919bc558c07a11689edde60c3f895ae00bb2c8dbaf2c12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '03255082c51014d08e1125e733ba03e5d57e0ee65b1582969fde737f51c7381cdc084eafe86469cf44728dca516dea841ba92516ca72737b110e63fcbaa0d7cd'
|
7
|
+
data.tar.gz: 73107c7a4a609b4bfeed24540ecf9fc04a5b423eed16a4ec31c695c9c650cbcd82178d3fc723b2cfed08027b0bd89df82030e70b90049424d95b50e6af548514
|
@@ -48,11 +48,11 @@ module Subroutine
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def build_foreign_key_field
|
51
|
-
build_child_field(foreign_key_method)
|
51
|
+
build_child_field(foreign_key_method, type: :integer)
|
52
52
|
end
|
53
53
|
|
54
54
|
def build_foreign_type_field
|
55
|
-
build_child_field(foreign_type_method)
|
55
|
+
build_child_field(foreign_type_method, type: :string)
|
56
56
|
end
|
57
57
|
|
58
58
|
def unscoped?
|
@@ -65,8 +65,8 @@ module Subroutine
|
|
65
65
|
|
66
66
|
protected
|
67
67
|
|
68
|
-
def build_child_field(name)
|
69
|
-
ComponentConfiguration.new(name, inheritable_options.merge(association_name: as))
|
68
|
+
def build_child_field(name, opts = {})
|
69
|
+
ComponentConfiguration.new(name, inheritable_options.merge(opts).merge(association_name: as))
|
70
70
|
end
|
71
71
|
|
72
72
|
end
|
@@ -69,16 +69,17 @@ module Subroutine
|
|
69
69
|
config = ::Subroutine::AssociationFields::Configuration.new(field_name, options)
|
70
70
|
|
71
71
|
if config.polymorphic?
|
72
|
-
|
72
|
+
field config.foreign_type_method, config.build_foreign_type_field
|
73
73
|
else
|
74
74
|
class_eval <<-EV, __FILE__, __LINE__ + 1
|
75
|
+
try(:silence_redefinition_of_method, :#{config.foreign_type_method})
|
75
76
|
def #{config.foreign_type_method}
|
76
77
|
#{config.inferred_class_name.inspect}
|
77
78
|
end
|
78
79
|
EV
|
79
80
|
end
|
80
81
|
|
81
|
-
|
82
|
+
field config.foreign_key_method, config.build_foreign_key_field
|
82
83
|
|
83
84
|
field_without_association(config.as, config)
|
84
85
|
else
|
data/lib/subroutine/fields.rb
CHANGED
@@ -119,16 +119,18 @@ module Subroutine
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def ensure_field_accessors(config)
|
122
|
-
if config.field_writer?
|
122
|
+
if config.field_writer?
|
123
123
|
class_eval <<-EV, __FILE__, __LINE__ + 1
|
124
|
+
try(:silence_redefinition_of_method, :#{config.field_name}=)
|
124
125
|
def #{config.field_name}=(v)
|
125
126
|
set_field(:#{config.field_name}, v)
|
126
127
|
end
|
127
128
|
EV
|
128
129
|
end
|
129
130
|
|
130
|
-
if config.field_reader?
|
131
|
+
if config.field_reader?
|
131
132
|
class_eval <<-EV, __FILE__, __LINE__ + 1
|
133
|
+
try(:silence_redefinition_of_method, :#{config.field_name})
|
132
134
|
def #{config.field_name}
|
133
135
|
get_field(:#{config.field_name})
|
134
136
|
end
|
data/lib/subroutine/version.rb
CHANGED