Module: Plutonium::Interaction::Concerns::Scoping
- Extended by:
- ActiveSupport::Concern
- Included in:
- ApiClient::Concerns::CreateApiClient, Dispatchable
- Defined in:
- lib/plutonium/interaction/concerns/scoping.rb
Overview
Scoping concern provides access to scoped records from the controller context.
This handles both:
- Entity scoping: Portal-level multi-tenancy via
scope_to_entity(accessed viacurrent_scoped_entity) - Parent scoping: Nested routes (accessed via
current_parent)
The scoped_record_of_type method checks both contexts and ensures type safety.
Precondition
These methods read the controller the interaction is rendering in, so
they require a Plutonium controller: current_scoped_entity needs
Core::Controllers::EntityScoping (which Plutonium::Core::Controller
includes, portal or not), and current_parent needs
Plutonium::Resource::Controller. Called anywhere else they raise
NoMethodError, deliberately — see #current_parent. An interaction that
can run outside a resource controller must not ask for a parent.