Replace an existing state machine in solidus - ruby-on-rails

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:
# app/overrides/your_store/order/do_stuff_after_confirm.rb
module YourStore
module Order
module DoStuffAfterConfirm
def self.prepended(base)
base.state_machine.after_transition to: :confirm, do: :your_business!
end
def your_business!
# ...
end
Spree::Order.prepend self
end
end
end

Related

Ruby/Rails terminal commands are missing first line of error output

I've been suffering from this issue for a rather long time and have mostly put up with it but I can't anymore. I have tried to look for a solution to no avail.
Whenever I try to perform a ruby/rails call from my terminal, I am missing the first line of any error output.
As you can see in the example below, the first line, which includes the actual error message, is missing.
For more info:
I am running Ubuntu 20.04 with a zsh/oh-my-zsh shell, but this also happens in bash. This has been happening for several versions of ruby now.
Example:
➜ CODE_BASE git:(branch_name) ✗ rails routes
Traceback (most recent call last):
42: from bin/rails:9:in `<main>'
41: from bin/rails:9:in `require'
40: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/commands.rb:18:in `<top (required)>'
39: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/command.rb:48:in `invoke'
38: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/command/base.rb:69:in `perform'
37: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
36: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
35: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
34: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/commands/routes/routes_command.rb:13:in `perform'
33: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
32: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/command/actions.rb:28:in `require_environment!'
31: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/application.rb:367:in `require_environment!'
30: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
29: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
28: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
27: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
26: from /home/penguin/Projects/CODE_BASE/config/environment.rb:5:in `<top (required)>'
25: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/application.rb:391:in `initialize!'
24: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/initializable.rb:60:in `run_initializers'
23: from /usr/share/rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/tsort.rb:205:in `tsort_each'
22: from /usr/share/rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/tsort.rb:226:in `tsort_each'
21: from /usr/share/rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/tsort.rb:347:in `each_strongly_connected_component'
20: from /usr/share/rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/tsort.rb:347:in `call'
19: from /usr/share/rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/tsort.rb:347:in `each'
18: from /usr/share/rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/tsort.rb:349:in `block in each_strongly_connected_component'
17: from /usr/share/rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/tsort.rb:431:in `each_strongly_connected_component_from'
16: from /usr/share/rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
15: from /usr/share/rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/tsort.rb:228:in `block in tsort_each'
14: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/initializable.rb:61:in `block in run_initializers'
13: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `run'
12: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `instance_exec'
11: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/application/finisher.rb:195:in `block in <module:Finisher>'
10: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/application/routes_reloader.rb:10:in `execute'
9: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.4.1/lib/active_support/file_update_checker.rb:83:in `execute'
8: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/application/routes_reloader.rb:35:in `block in updater'
7: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/application/routes_reloader.rb:21:in `reload!'
6: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/application/routes_reloader.rb:47:in `load_paths'
5: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/application/routes_reloader.rb:47:in `each'
4: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/railties-6.1.4.1/lib/rails/application/routes_reloader.rb:47:in `block in load_paths'
3: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:326:in `load'
2: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
1: from /home/penguin/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:326:in `block in load'
/home/penguin/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:326:in `load':

undefined method `discard_on' for ActiveStorage::PurgeJob:Class (NoMethodError)

After recently upgrading to Rails 5.2 from 4.2 I am trying to test production but this occurs everytime I start.
Traceback (most recent call last):
55: from script/rails:6:in `<main>'
54: from script/rails:6:in `require'
53: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/commands.rb:18:in `<top (required)>'
52: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/command.rb:46:in `invoke'
51: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/command/base.rb:69:in `perform'
50: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
49: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
48: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
47: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/commands/console/console_command.rb:95:in `perform'
46: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
45: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/command/actions.rb:28:in `require_environment!'
44: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/application.rb:337:in `require_environment!'
43: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
42: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency'
41: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require'
40: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
39: from /home/deploy/DSM/config/environment.rb:5:in `<top (required)>'
38: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/railtie.rb:190:in `method_missing'
37: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/railtie.rb:190:in `public_send'
36: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/application.rb:361:in `initialize!'
35: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/initializable.rb:60:in `run_initializers'
34: from /home/deploy/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
33: from /home/deploy/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
32: from /home/deploy/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
31: from /home/deploy/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `call'
30: from /home/deploy/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each'
29: from /home/deploy/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
28: from /home/deploy/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
27: from /home/deploy/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
26: from /home/deploy/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
25: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/initializable.rb:61:in `block in run_initializers'
24: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/initializable.rb:32:in `run'
23: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/initializable.rb:32:in `instance_exec'
22: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
21: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/application/finisher.rb:69:in `each'
20: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/engine.rb:356:in `eager_load!'
19: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/engine.rb:475:in `eager_load!'
18: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/engine.rb:475:in `each'
17: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/engine.rb:477:in `block in eager_load!'
16: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/engine.rb:477:in `each'
15: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/railties-5.2.4.3/lib/rails/engine.rb:478:in `block (2 levels) in eager_load!'
14: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:246:in `require_dependency'
13: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:334:in `depend_on'
12: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:356:in `require_or_load'
11: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:37:in `load_interlock'
10: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies/interlock.rb:13:in `loading'
9: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
8: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
7: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:37:in `block in load_interlock'
6: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:378:in `block in require_or_load'
5: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
4: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency'
3: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require'
2: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
1: from /home/deploy/.rvm/gems/ruby-2.5.1/gems/activestorage-5.2.4.3/app/jobs/active_storage/purge_job.rb:4:in `<top (required)>'
/home/deploy/.rvm/gems/ruby-2.5.1/gems/activestorage-5.2.4.3/app/jobs/active_storage/purge_job.rb:5:in `<class:PurgeJob>': undefined method `discard_on' for ActiveStorage::PurgeJob:Class (NoMethodError)
The following doesn't happen in development/test or with eager_load disabled in production.rb, which makes sense.
I am using rvm (2.5.1, 2.5.0, 2.6.5) tried all three.
rails -v: Rails 5.2.4.3
These are built in methods so I'm not sure best way to TS/resolve.
So I figured it out.
I had attempted to go to rails 6 but there was too much that needed to be changed. In doing so I had activejob_backport-0.0.3 in my rvm gems directory and after removing it, the issue no longer occurred.

undefined method `alias_method_chain' for ActiveRecord::ConnectionAdapters::Table:Class (NoMethodError). Did you mean? alias_method

I am getting this error while creating a migration. I'm using MySQL as the database, with rails 6.0.3.2 and ruby 2.6.6
the full error is
Traceback (most recent call last):
51: from bin/rails:4:in `<main>'
50: from bin/rails:4:in `require'
49: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/commands.rb:18:in `<top (required)>'
48: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/command.rb:46:in `invoke'
47: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/command/base.rb:69:in `perform'
46: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
45: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
44: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
43: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/commands/generate/generate_command.rb:21:in `perform'
42: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
41: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/command/actions.rb:28:in `require_environment!'
40: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/application.rb:339:in `require_environment!'
39: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `require'
38: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'
37: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `block in require'
36: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
35: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
34: from C:/Users/Ritvik/Desktop/railsProjs/bkpk/config/environment.rb:5:in `<top (required)>'
33: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/application.rb:363:in `initialize!'
32: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/initializable.rb:60:in `run_initializers'
31: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
30: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
29: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
28: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:347:in `call'
27: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:347:in `each'
26: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
25: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
24: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
23: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
22: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/initializable.rb:61:in `block in run_initializers'
21: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/initializable.rb:32:in `run'
20: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/initializable.rb:32:in `instance_exec'
19: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/railtie.rb:4:in `block in <class:Railtie>'
18: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:42:in `on_load'
17: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:42:in `each'
16: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:43:in `block in on_load'
15: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
14: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
13: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
12: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
11: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/railtie.rb:5:in `block (2 levels) in <class:Railtie>'
10: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/loader.rb:3:in `load'
9: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/loader.rb:3:in `module_eval'
8: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/loader.rb:5:in `block in load'
7: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/loader.rb:5:in `include'
6: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/connection_adapters/abstract/schema_definitions.rb:5:in `included'
5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/connection_adapters/abstract/schema_definitions.rb:5:in `class_eval'
4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/connection_adapters/abstract/schema_definitions.rb:6:in `block in included'
3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/connection_adapters/abstract/schema_definitions.rb:6:in `include'
2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/concern.rb:122:in `append_features'
1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/concern.rb:122:in `class_eval'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/connection_adapters/abstract/table.rb:7:in `block in <module:Table>': undefined method `alias_method_chain' for ActiveRecord::ConnectionAdapters::Table:Class (NoMethodError)
Did you mean? alias_method
I've looked at similar errors on stackoverflow, but haven't found a solution to my problem.
The gemfile has gem 'mysql2', '>= 0.4.4'. I tried it on MySQL 0.5.3 but still no luck.
Do you have foreigner gem in your gemfile ? Can you try removing it, doing a bundle install and retry ? According to the documentation of the gem it was rendered obsolete from rails 4.2 as rails added native support for the feature.
If it is not in your gemfile, you need to check what gem depends on it.

uninitialized constant ActiveRecord::ConnectionAdapters::ConnectionManagement (NameError) in Rails 6 upgrade

I am currently in the middle of upgrading a rails project from v5.2.3 to v6.0. I am following this guide to upgrade rails. But i am stuck on just first step.
As soon i changed the rails version in gemfile and updated rails nothing is working. Running rails server is giving me this error uninitialized constant ActiveRecord::ConnectionAdapters::ConnectionManagement (NameError)
Below is the full stacktrace:
53: from bin/rails:4:in `<main>'
52: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
51: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
50: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
49: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
48: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
47: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands.rb:18:in `<main>'
46: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/command.rb:46:in `invoke'
45: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/command/base.rb:65:in `perform'
44: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
43: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
42: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
41: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `perform'
40: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `tap'
39: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:147:in `block in perform'
38: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:37:in `start'
37: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
36: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:354:in `wrapped_app'
35: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:219:in `app'
34: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:319:in `build_app_and_options_from_config'
33: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:40:in `parse_file'
32: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `new_from_string'
31: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `eval'
30: from config.ru:in `<main>'
29: from config.ru:in `new'
28: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `initialize'
27: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `instance_eval'
26: from config.ru:3:in `block in <main>'
25: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/kernel.rb:23:in `require'
24: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
23: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
22: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
21: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
20: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
19: from /Volumes/gitdisk/PAC/codephod2/config/environment.rb:5:in `<main>'
18: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/application.rb:363:in `initialize!'
17: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:60:in `run_initializers'
16: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
15: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
14: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
13: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `call'
12: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `each'
11: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
10: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
9: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
8: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
7: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:61:in `block in run_initializers'
6: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `run'
5: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `instance_exec'
4: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/airbrake-5.8.1/lib/airbrake/rails/railtie.rb:26:in `block in <class:Railtie>'
3: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `load_missing_constant'
2: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `rescue in load_missing_constant'
1: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
/Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `block in load_missing_constant': uninitialized constant ActiveRecord::ConnectionAdapters::ConnectionManagement (NameError)
I had the same problem. I fixed it upgrading airbrake gem
gem 'airbrake', '~> 10.0.3'
Somewhere in your code you are calling the deprecated constant: ActiveRecord::ConnectionAdapters::ConnectionManagement. From your stack trace I suspect is in the outdated version of the airbrake gem you are using. Try updating airbrake to a more recent version. Let me know if this sorts it out for you.
You can see more about this here

undefined method `halt_callback_chains_on_return_false=

I'm upgrading a Rails 5.1 application to 5.2. I've updated all of my gems including Rails and finally ran rails app:update which created new files for my rails app.
Specifically there are two files that were created that concern me. First in config/initializers there is a new_framework_defaults_5_2.rb file and second (in the same directory) a new_framework_defaults.rb. The first file only contains comments, but the second file contains some new configuration options. One of those options is this:
ActiveSupport.halt_callback_chains_on_return_false = false
This method call throws a undefined_method error. What do I need to do with this line of code?
Here is the stacktrace:
Traceback (most recent call last):
73: from bin/rails:4:in `<main>'
72: from /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
71: from /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
70: from /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
69: from /usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
68: from /usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
67: from /usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
66: from /usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
65: from /usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
64: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<main>'
63: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/command.rb:46:in `invoke'
62: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/command/base.rb:65:in `perform'
61: from /usr/local/rvm/gems/ruby-2.5.1/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
60: from /usr/local/rvm/gems/ruby-2.5.1/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
59: from /usr/local/rvm/gems/ruby-2.5.1/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
58: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `perform'
57: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `tap'
56: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:147:in `block in perform'
55: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:51:in `start'
54: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:89:in `log_to_stdout'
53: from /usr/local/rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/server.rb:354:in `wrapped_app'
52: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:27:in `app'
51: from /usr/local/rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/server.rb:219:in `app'
50: from /usr/local/rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/server.rb:319:in `build_app_and_options_from_config'
49: from /usr/local/rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/builder.rb:40:in `parse_file'
48: from /usr/local/rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/builder.rb:49:in `new_from_string'
47: from /usr/local/rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/builder.rb:49:in `eval'
46: from config.ru:in `<main>'
45: from config.ru:in `new'
44: from /usr/local/rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/builder.rb:55:in `initialize'
43: from /usr/local/rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/builder.rb:55:in `instance_eval'
42: from config.ru:3:in `block in <main>'
41: from /usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require_relative'
40: from /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
39: from /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
38: from /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
37: from /usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
36: from /usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
35: from /usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
34: from /usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
33: from /usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
32: from /home/www-upload/treadmilldoctorcurrent/config/environment.rb:5:in `<main>'
31: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
30: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
29: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
28: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
27: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
26: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `call'
25: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each'
24: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
23: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:415:in `each_strongly_connected_component_from'
22: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:415:in `call'
21: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/initializable.rb:50:in `tsort_each_child'
20: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/initializable.rb:50:in `each'
19: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
18: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
17: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
16: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
15: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
14: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
13: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
12: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
11: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/engine.rb:613:in `block in <class:Engine>'
10: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/engine.rb:613:in `each'
9: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
8: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/engine.rb:656:in `load_config_initializer'
7: from /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.0/lib/active_support/notifications.rb:170:in `instrument'
6: from /usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/engine.rb:657:in `block in load_config_initializer'
5: from /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:277:in `load'
4: from /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
3: from /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:277:in `block in load'
2: from /usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
1: from /usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
/home/www-upload/treadmilldoctorcurrent/config/initializers/new_framework_defaults.rb:21:in `<main>': undefined method `halt_callback_chains_on_return_false=' for
ActiveSupport:Module (NoMethodError)
Thanks in advance.
I encountered the same issue during my last upgrade from 5.1 to 5.2.
What I did is just comment out this line in config/initializers/new_framework_defaults.rb
# Do not halt callback chains when a callback returns false. Previous versions had true.
# ActiveSupport.halt_callback_chains_on_return_false = false
I guess the reason it raise this error because halt_callback_chains_on_return_false option is actually remove from ActiveSupport according to this release note.
This is the previous behavior:
WelcomeController < ApplicationController
before_action: -> { return false }
def index
# would not be called
end
end
What the halt_callback_chains_on_return_false = false does:
WelcomeController < ApplicationController
before_action: -> { return false }
def index
# would now be rendered regardless of the before_action filter chain's return value
end
end
What Rails thinks you should do in filter chains to prevent rendering:
WelcomeController < ApplicationController
before_action: -> { raise 'Error' }
def index
# would not be rendered
end
end
Hope this helps.
Best,
Emil
halt_callback_chains_on_return_false setting in the initializer
This was a solution for temporary keeping old callback behaviour after upgrade to Rails 5.0. Assumed that you need time to check all callbacks in the app and after it you can remove this setting. And assumed that on the upgrade to 5.2 all is already checked, so this setting is removed.
Just comment out the line as #worrawut recommends in the
config/initializers/new_framework_defaults.rb file.

Resources