I need to customize few state machines' behaviour for our business requirement and followed the documentation for the solidus recommended way of replacing an existing state machine. However, I am not being able to do so this way. Do I have to do something extra besides the fact mentioned in the documentation ? I can also think of an alternative way of clearing out existing states and events for the models and redefining the state machines required in the models themselves. However, I prefer to go with this way if possible.
Here, the application traceback for the issue.
DEPRECATION WARNING: Devise::Models::Authenticatable::BLACKLIST_FOR_SERIALIZATION is deprecated! Use Devise::Models::Authenticatable::UNSAFE_ATTRIBUTES_FOR_SERIALIZATION instead. (called from <main> at /home/sis/Bajra/adguru/config/application.rb:27)
=> Booting Puma
=> Rails 6.0.3.7 application starting in development
=> Run `rails server --help` for more startup options
Exiting
Traceback (most recent call last):
69: from bin/rails:3:in `<main>'
68: from bin/rails:3:in `load'
67: from /home/sis/Bajra/adguru/bin/spring:15:in `<top (required)>'
66: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
65: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
64: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
63: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
62: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
61: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
60: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
59: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
58: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
57: from /home/sis/Bajra/adguru/bin/rails:9:in `<top (required)>'
56: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
55: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
54: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/commands.rb:18:in `<main>'
53: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/command.rb:46:in `invoke'
52: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/command/base.rb:69:in `perform'
51: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
50: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
49: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
48: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/commands/server/server_command.rb:138:in `perform'
47: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/commands/server/server_command.rb:138:in `tap'
46: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/commands/server/server_command.rb:147:in `block in perform'
45: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/commands/server/server_command.rb:37:in `start'
44: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
43: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
42: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
41: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
40: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
39: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
38: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
37: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
36: from config.ru:5:in `block in <main>'
35: from config.ru:5:in `require_relative'
34: from /home/sis/Bajra/adguru/config/environment.rb:7:in `<main>'
33: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/application.rb:363:in `initialize!'
32: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/initializable.rb:60:in `run_initializers'
31: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
30: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
29: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
28: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `call'
27: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each'
26: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
25: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
24: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:415:in `call'
23: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/initializable.rb:50:in `tsort_each_child'
22: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/initializable.rb:50:in `each'
21: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
20: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
19: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
18: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
17: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
16: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/initializable.rb:61:in `block in run_initializers'
15: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/initializable.rb:32:in `run'
14: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/initializable.rb:32:in `instance_exec'
13: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/engine.rb:624:in `block in <class:Engine>'
12: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/engine.rb:624:in `each'
11: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/engine.rb:625:in `block (2 levels) in <class:Engine>'
10: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/engine.rb:665:in `load_config_initializer'
9: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:182:in `instrument'
8: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/engine.rb:666:in `block in load_config_initializer'
7: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:318:in `load'
6: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:291:in `load_dependency'
5: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:318:in `block in load'
4: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
3: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
2: from /home/sis/Bajra/adguru/config/initializers/spree.rb:6:in `<main>'
1: from /home/sis/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/solidus_core-2.10.0.beta1/lib/spree/core.rb:45:in `config'
/home/sis/Bajra/adguru/config/initializers/spree.rb:22:in `block in <main>': undefined method `state_machines' for #<Spree::AppConfiguration:0x000055cc946bb3c0> (NoMethodError)
you are using an old version of Solidus. The feature described in the guides you linked, which allows using a different class for your state machines, refers to more recent versions (
2.11+
if I recall correctly).If you want you can still customize your state machines by monkey patching them. For example, to change the Order state machine: