Can't select all records then dissociate has many relationship of a collection

Feature(s) impacted

The “Dissociate the relationship” action on a has many collection when I “select all records”

Observed behavior

It fails to dissociate the relationship with a error message “update failed: unexpected error.”
It works fine when I select with “Select current page only” though.

Expected behavior

It dissociates the relationship the same way than when I select records with “Select current page only”

Failure Logs

Looking in the rails server logs, it says

[2023-02-02 10:56:30] Forest 🌳🌳🌳  Association Associate error: undefined method `[]' for nil:NilClass
       raise 'Missing required rendering_id' unless user['rendering_id']
                                                        ^^^^^^^^^^^^^^^^
 /app/vendor/bundle/ruby/3.1.0/gems/forest_liana-7.7.0/app/services/forest_liana/scope_manager.rb:30:in `get_scope_for_user'
 	/app/vendor/bundle/ruby/3.1.0/gems/forest_liana-7.7.0/app/services/forest_liana/scope_manager.rb:16:in `append_scope_for_user'
 	/app/vendor/bundle/ruby/3.1.0/gems/forest_liana-7.7.0/app/services/forest_liana/search_query_builder.rb:22:in `perform'
 	/app/vendor/bundle/ruby/3.1.0/gems/forest_liana-7.7.0/app/services/forest_liana/has_many_getter.rb:68:in `prepare_query'
 	/app/vendor/bundle/ruby/3.1.0/gems/forest_liana-7.7.0/app/services/forest_liana/has_many_getter.rb:18:in `initialize'
 	/app/vendor/bundle/ruby/3.1.0/gems/forest_liana-7.7.0/app/services/forest_liana/resources_getter.rb:45:in `new'
 	/app/vendor/bundle/ruby/3.1.0/gems/forest_liana-7.7.0/app/services/forest_liana/resources_getter.rb:45:in `get_ids_from_request'
 	/app/vendor/bundle/ruby/3.1.0/gems/forest_liana-7.7.0/app/services/forest_liana/has_many_dissociator.rb:20:in `perform'
 	/app/vendor/bundle/ruby/3.1.0/gems/forest_liana-7.7.0/app/controllers/forest_liana/associations_controller.rb:76:in `dissociate'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/abstract_controller/base.rb:215:in `process_action'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_controller/metal/rendering.rb:53:in `process_action'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/abstract_controller/callbacks.rb:234:in `block in process_action'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
 	/app/vendor/bundle/ruby/3.1.0/gems/actiontext-7.0.3.1/lib/action_text/rendering.rb:20:in `with_renderer'
 	/app/vendor/bundle/ruby/3.1.0/gems/actiontext-7.0.3.1/lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:127:in `instance_exec'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:138:in `run_callbacks'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/abstract_controller/callbacks.rb:233:in `process_action'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/notifications.rb:206:in `block in instrument'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/notifications.rb:206:in `instrument'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_controller/metal/instrumentation.rb:66:in `process_action'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
 	/app/vendor/bundle/ruby/3.1.0/gems/searchkick-4.5.0/lib/searchkick/logging.rb:212:in `process_action'
 	/app/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.3.1/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/abstract_controller/base.rb:151:in `process'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionview-7.0.3.1/lib/action_view/rendering.rb:39:in `process'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_controller/metal.rb:188:in `dispatch'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_controller/metal.rb:251:in `dispatch'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/routing/route_set.rb:32:in `serve'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/journey/router.rb:32:in `each'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/journey/router.rb:32:in `serve'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/routing/route_set.rb:852:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/stack.rb:61:in `block in call'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/notifications.rb:206:in `block in instrument'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/notifications.rb:206:in `instrument'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/stack.rb:60:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/railties-7.0.3.1/lib/rails/engine.rb:530:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/railties-7.0.3.1/lib/rails/railtie.rb:226:in `public_send'
 	/app/vendor/bundle/ruby/3.1.0/gems/railties-7.0.3.1/lib/rails/railtie.rb:226:in `method_missing'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/routing/mapper.rb:48:in `serve'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/journey/router.rb:32:in `each'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/journey/router.rb:32:in `serve'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/routing/route_set.rb:852:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/rack/agent_hooks.rb:31:in `traced_call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/rack/browser_monitoring.rb:34:in `traced_call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:266:in `context'
 	/app/vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:260:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/cookies.rb:697:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/warden-1.2.9/lib/warden/manager.rb:36:in `block in call'
 	/app/vendor/bundle/ruby/3.1.0/gems/warden-1.2.9/lib/warden/manager.rb:34:in `catch'
 	/app/vendor/bundle/ruby/3.1.0/gems/warden-1.2.9/lib/warden/manager.rb:34:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb:15:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/etag.rb:27:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/conditional_get.rb:40:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/head.rb:12:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/http/permissions_policy.rb:38:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/http/content_security_policy.rb:36:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:266:in `context'
 	/app/vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:260:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/cookies.rb:697:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.3.1/lib/active_record/migration.rb:603:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/callbacks.rb:99:in `run_callbacks'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/better_errors-2.9.1/lib/better_errors/middleware.rb:62:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/railties-7.0.3.1/lib/rails/rack/logger.rb:40:in `call_app'
 	/app/vendor/bundle/ruby/3.1.0/gems/railties-7.0.3.1/lib/rails/rack/logger.rb:25:in `block in call'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/tagged_logging.rb:114:in `block in tagged'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/tagged_logging.rb:38:in `tagged'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/tagged_logging.rb:114:in `tagged'
 	/app/vendor/bundle/ruby/3.1.0/gems/railties-7.0.3.1/lib/rails/rack/logger.rb:25:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/request_id.rb:26:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/method_override.rb:24:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/runtime.rb:22:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.3.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/server_timing.rb:20:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/static.rb:23:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/sendfile.rb:110:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.3.1/lib/action_dispatch/middleware/host_authorization.rb:137:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/railties-7.0.3.1/lib/rails/engine.rb:530:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.10.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/puma-5.6.5/lib/puma/configuration.rb:252:in `call'
 	/app/vendor/bundle/ruby/3.1.0/gems/puma-5.6.5/lib/puma/request.rb:77:in `block in handle_request'
 	/app/vendor/bundle/ruby/3.1.0/gems/puma-5.6.5/lib/puma/thread_pool.rb:340:in `with_force_shutdown'
 	/app/vendor/bundle/ruby/3.1.0/gems/puma-5.6.5/lib/puma/request.rb:76:in `handle_request'
 	/app/vendor/bundle/ruby/3.1.0/gems/puma-5.6.5/lib/puma/server.rb:443:in `process_client'
 	/app/vendor/bundle/ruby/3.1.0/gems/puma-5.6.5/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
 Cannot load the association reporting on Product 49206.

I think something goes wrong on the forest_liana gem that does not authenticate the forest_user on this specific request?

Context

Rails 7 application
latest forest_liana gem at the time I’m posting this (7.8.0)

Thank you for your time and help :slight_smile:

Hey @Na0na0, and welcome to our community :wave:

I can’t reproduce the issue on my end.
Could you please share your model Product?