statesman-multi_state 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/statesman/multi_state/active_record_macro.rb +3 -3
- data/lib/statesman/multi_state/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e46de0c69e16445bf06a31f55dd04be09853dcb41773cc61252e45f17cc84fdb
|
4
|
+
data.tar.gz: 05b43b0794b37be03bd9d97b45b5660a3ffa8e095b0c903754d7f478d0d48dd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cdfde1e0826666e57cb82d6be2eff7649675ba8d170520b40c22a139c3fc981030b07b072f454148d446ba7cc71121e09644a03709d2ba618307153bb6558a3
|
7
|
+
data.tar.gz: 76efdb5cc4e0217f2f6543aef1b5689d0c5375420d34970da6f29b1b995593ef6045b71bb32bb6741bc3157e41870ab56d2006ba228f708d7e3dac6923cc9b21
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Statesman::MultiState
|
2
|
-
![Build](https://github.com/chaadow/statesman-multi_state/actions/workflows/ruby.yml
|
1
|
+
# Statesman::MultiState
|
2
|
+
[![Gem](https://img.shields.io/gem/v/statesman-multi_state?style=for-the-badge)](https://rubygems.org/gems/statesman-multi_state) [![Build Status](https://img.shields.io/github/actions/workflow/status/chaadow/statesman-multi_state/ruby.yml?style=for-the-badge)](https://github.com/chaadow/statesman-multi_state/actions/workflows/ruby.yml)
|
3
3
|
|
4
4
|
Handle multiple state machines on the same ActiveRecord model for `statesman` through `has_one_state_machine` ActiveRecord macro.
|
5
5
|
|
@@ -8,9 +8,9 @@ module Statesman
|
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
10
|
class_methods do
|
11
|
-
def has_one_state_machine(field_name, state_machine_klass:, transition_klass:,
|
11
|
+
def has_one_state_machine(field_name, state_machine_klass:, transition_klass:,
|
12
|
+
transition_name: transition_klass.to_s.underscore.pluralize.to_sym, virtual_attribute_name: "#{field_name}_state_form")
|
12
13
|
state_machine_name = "#{field_name}_state_machine"
|
13
|
-
virtual_attribute_name = "#{field_name}_state_form"
|
14
14
|
|
15
15
|
# To handle STI, this needs to be done to get the base klass
|
16
16
|
base_klass = caller_locations.first.label.split(':').last[...-1]
|
@@ -94,7 +94,7 @@ module Statesman
|
|
94
94
|
field_name,
|
95
95
|
nil,
|
96
96
|
{ state_machine_klass: state_machine_klass, transition_klass: transition_klass,
|
97
|
-
transition_name: transition_name },
|
97
|
+
transition_name: transition_name, virtual_attribute_name: virtual_attribute_name },
|
98
98
|
self
|
99
99
|
)
|
100
100
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statesman-multi_state
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chedli Bourguiba
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|