statesman-multi_state 0.2.3 → 0.2.5
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: 72d09a68d4f64028e6376bee25b22a22d0e1bd299fde5e49f74adc9220cb034b
|
4
|
+
data.tar.gz: 7682734dee3c90329c5a630116f8682ad7824bc3164b3c55ae472d2e71ef9b77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3ad119c6bea29649e78fee1b6a295b7a5fab795ec860c3741d3722c58e2284612541d627c78b0ec645937175cf64378b0aaadaeea51be1d0a2ef0fb4126278f
|
7
|
+
data.tar.gz: 438244f9e6f1b1775d47653ef29708335661968b8e3dae317df452094ce0ec8c743d976eeb22e752bedc137bd836ef406f89b90fc8b0c85c09522d53421e46f5
|
@@ -11,7 +11,7 @@ module Statesman
|
|
11
11
|
class_methods do
|
12
12
|
def has_one_state_machine(field_name, state_machine_klass:, transition_klass:,
|
13
13
|
transition_name: transition_klass.to_s.demodulize.underscore.pluralize.to_sym, virtual_attribute_name: "#{field_name}_state_form",
|
14
|
-
transition_foreign_key: nil)
|
14
|
+
transition_foreign_key: nil, initial_transition: true)
|
15
15
|
state_machine_name = "#{field_name}_state_machine"
|
16
16
|
|
17
17
|
# To handle STI, this needs to be done to get the base klass
|
@@ -44,7 +44,8 @@ module Statesman
|
|
44
44
|
instance_variable_set(key, #{state_machine_klass}.new(
|
45
45
|
self,
|
46
46
|
transition_class: #{transition_klass},
|
47
|
-
association_name: "#{transition_name}"
|
47
|
+
association_name: "#{transition_name}",
|
48
|
+
initial_transition: "#{initial_transition}"
|
48
49
|
))
|
49
50
|
end
|
50
51
|
|
@@ -86,7 +87,7 @@ module Statesman
|
|
86
87
|
save.tap do
|
87
88
|
@registered_callbacks.each(&:call)
|
88
89
|
@registered_callbacks = []
|
89
|
-
end
|
90
|
+
end
|
90
91
|
end
|
91
92
|
end
|
92
93
|
METHOD
|
@@ -99,7 +100,7 @@ module Statesman
|
|
99
100
|
nil,
|
100
101
|
{ state_machine_klass: state_machine_klass, transition_klass: transition_klass,
|
101
102
|
transition_name: transition_name, virtual_attribute_name: virtual_attribute_name,
|
102
|
-
transition_foreign_key: transition_foreign_key },
|
103
|
+
transition_foreign_key: transition_foreign_key, initial_transition: initial_transition },
|
103
104
|
self
|
104
105
|
)
|
105
106
|
|