AlchemyCMS / alchemy_cms

Alchemy is the Open Source Rails CMS framework for the component based web that can be used as classic server side rendered or headless CMS.
https://www.alchemy-cms.com
BSD 3-Clause "New" or "Revised" License
845 stars 314 forks source link

NoMethodError undefined method `with_connection' with Rails 7.2.1 #3055

Closed afdev82 closed 1 month ago

afdev82 commented 1 month ago

Steps to reproduce

Go to the admin section and click on one item in the left menu, except "Home" and "Menus".

Expected behavior

Display the requested page.

Actual behavior

It shows the following exception:

 NoMethodError undefined method `with_connection' for an instance of ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
Show error details
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activerecord-7.2.1/lib/active_record/associations/alias_tracker.rb:10:in `create'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/ransack-4.1.1/lib/ransack/adapters/active_record/context.rb:281:in `build_joins'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/ransack-4.1.1/lib/ransack/adapters/active_record/context.rb:249:in `join_dependency'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/ransack-4.1.1/lib/ransack/context.rb:40:in `initialize'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/ransack-4.1.1/lib/ransack/context.rb:13:in `new'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/ransack-4.1.1/lib/ransack/context.rb:13:in `for_class'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/ransack-4.1.1/lib/ransack/context.rb:27:in `for'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/ransack-4.1.1/lib/ransack/search.rb:32:in `initialize'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/ransack-4.1.1/lib/ransack/adapters/active_record/base.rb:16:in `new'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/ransack-4.1.1/lib/ransack/adapters/active_record/base.rb:16:in `ransack'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activerecord-7.2.1/lib/active_record/relation/delegation.rb:120:in `public_send'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activerecord-7.2.1/lib/active_record/relation/delegation.rb:120:in `block in method_missing'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activerecord-7.2.1/lib/active_record/relation.rb:1355:in `_scoping'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activerecord-7.2.1/lib/active_record/relation.rb:541:in `scoping'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activerecord-7.2.1/lib/active_record/relation/delegation.rb:120:in `method_missing'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/bundler/gems/alchemy_cms-455779629431/app/controllers/alchemy/admin/languages_controller.rb:9:in `index'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_controller/metal/basic_implicit_render.rb:8:in `send_action'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/abstract_controller/base.rb:226:in `process_action'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_controller/metal/rendering.rb:193:in `process_action'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/abstract_controller/callbacks.rb:261:in `block in process_action'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activesupport-7.2.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activesupport-7.2.1/lib/active_support/core_ext/time/zones.rb:65:in `use_zone'
/Users/antonio.facciolo/Projects/adNotam/website/app/controllers/application_controller.rb:59:in `set_time_zone'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activesupport-7.2.1/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/turbo-rails-2.0.10/lib/turbo-rails.rb:24:in `with_request_id'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/turbo-rails-2.0.10/app/controllers/concerns/turbo/request_id_tracking.rb:10:in `turbo_tracking_request_id'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activesupport-7.2.1/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actiontext-7.2.1/lib/action_text/rendering.rb:25:in `with_renderer'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actiontext-7.2.1/lib/action_text/engine.rb:71:in `block (4 levels) in <class:Engine>'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activesupport-7.2.1/lib/active_support/callbacks.rb:130:in `instance_exec'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activesupport-7.2.1/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/ahoy_matey-5.2.0/lib/ahoy/controller.rb:50:in `set_ahoy_request_store'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activesupport-7.2.1/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activesupport-7.2.1/lib/active_support/callbacks.rb:141:in `run_callbacks'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/abstract_controller/callbacks.rb:260:in `process_action'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_controller/metal/rescue.rb:27:in `process_action'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_controller/metal/instrumentation.rb:77:in `block in process_action'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activesupport-7.2.1/lib/active_support/notifications.rb:210:in `block in instrument'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activesupport-7.2.1/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activesupport-7.2.1/lib/active_support/notifications.rb:210:in `instrument'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_controller/metal/instrumentation.rb:76:in `process_action'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/activerecord-7.2.1/lib/active_record/railties/controller_runtime.rb:39:in `process_action'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/abstract_controller/base.rb:163:in `process'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionview-7.2.1/lib/action_view/rendering.rb:40:in `process'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_controller/metal.rb:252:in `dispatch'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_controller/metal.rb:335:in `dispatch'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_dispatch/routing/route_set.rb:67:in `dispatch'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_dispatch/routing/route_set.rb:50:in `serve'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_dispatch/journey/router.rb:53:in `block in serve'
/Users/antonio.facciolo/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.1/lib/action_dispatch/journey/router.rb:133:in `block in find_routes'

System configuration

afdev82 commented 1 month ago

I have searched for that method in alchemy and in my application, but I didn't find it. The rest of my application seems to work fine, I have this problem only in the Alchemy admin.

tvdeyen commented 1 month ago

@afdev82 maybe related to an outdated ransack version? Can you try to update ransack to ~> 4.2.1?

afdev82 commented 1 month ago

Thank you very much @tvdeyen, that was it.