Module: Plutonium::Interaction::Concerns::Scoping

Extended by:
ActiveSupport::Concern
Included in:
ApiClient::Concerns::CreateApiClient
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 via current_scoped_entity)
  • Parent scoping: Nested routes (accessed via current_parent)

The scoped_record_of_type method checks both contexts and ensures type safety.

Examples:

Using in an interaction

class MyInteraction < Plutonium::Resource::Interaction
  include Plutonium::Interaction::Concerns::Scoping

  def execute
    organization = scoped_record_of_type(Organization)
    # Returns the Organization from either entity or parent scope
  end
end